Upgrade to Pro — share decks privately, control downloads, hide ads and more …

OkinawaOpendays2016_ネットワーク運用コード化への取り組み

komeinw
December 13, 2016

 OkinawaOpendays2016_ネットワーク運用コード化への取り組み

komeinw

December 13, 2016
Tweet

More Decks by komeinw

Other Decks in Technology

Transcript

  1. ࣗݾ঺հ Okinawa Open Days 2016 ΞυςΫຊ෦ͷΠϯϑϥΤϯδχΞɻ ओʹΦϯϓϨͷωοτϫʔΫ(෺ཧ/Ծ૝)͓Αͼ OpenStackͷҰ෦Λ୲౰ɻ • SDN

    Japan 2016 ΞυςΫʹඞཁͳSDN • IT PRO EXPOʮωοτϫʔΫΛ؂ࢹ͢ΔZabbix ͷ׆༻ࣄྫʯ • Interop Tokyo 2015 / 2016 ͳͲ https://speakerdeck.com/komeiy/ ϓϩϑΟʔϧ@komeinw
  2. ฐࣾͷωοτϫʔΫߏ੒ Okinawa Open Days 2016 • SDN ͳ؀ڥ͸͋Δɻ ৽ͨʹ࡞ͬͨҰ෦ͷ؀ڥͰ࠾༻ •

    ඞཁʹԠͯͦ͡ͷ࣌ʑͰ࠷దͳϋʔυ΢ΣΞΛબ୒͠࠾༻͍ͯ͠Δ • ࠾༻͍ͯ͠Δϋʔυ΢ΣΞʹ͍ͭͯ͸ϚϧνϕϯμʔͰߏ੒ ͳΔ΂͘Φʔϓϯͳٕज़ͰSDNͳ ؀ڥͱͦ͏Ͱͳ͍؀ڥͷ྆ํΛέ Ξ͢Δඞཁ͕͋Δ
  3. ҰൠతͳωοτϫʔΫΤϯδχΞͷ͓࢓ࣄ • VLAN௥Ճ/มߋ • ϧʔςΟϯά௥Ճ/มߋ • ϩʔυόϥϯαʔઃఆ௥Ճ • ACL௥Ճ •

    τϥϑΟοΫ֬ೝ • VPNϢʔβ௥Ճ/มߋ Okinawa Open Days 2016 • ૿ڧͳͲͷߏ੒มߋ • ৽ٕज़ͷݕূ • τϥϒϧγϡʔτ • ߏ੒؅ཧ • ϕϯμʔίϯτϩʔϧ etc… ΤϯδχΞͱͯ͠͸ɺ ͜͜ʹ஫ྗ͍ͨ͠
  4. ԿΛ࡞ͬͨʁͲΜͳޮՌʁ • ެ։༻API Gateway • AWS CLI ΍ gcloud Έ͍ͨͳίϚϯυϥΠϯͷఏڙ

    • গਓ਺Ͱͷӡ༻ΛΧόʔ • ৽نαʔϏεͷ্ཱͪ͛εϐʔυΛଛͳΘͳ͍࢓૊Έ • ͭ·Βͳ͍࡞ۀ͸ۃྗ΍Γͨ͘ͳ͍ μϝɻ࡞ۀϛεɺϦϦʔε೔΁ͷӨڹɺΤϯδχΞͷϞνϕʔγϣϯ௿Լ Okinawa Open Days 2016 ͜ͷೋ͕ͭ͋Ε͹ࣗಈԽɾηϧϑαʔϏεԽ͸ଅਐͰ͖Δ
  5. Okinawa Open Days 2016 ϓϥΠϕʔτΫϥ΢υͷૢ࡞Πϝʔδ • ֶशίετ͕௿͍ʢΞϓϦέʔγϣϯͷ։ൃऀ͕ ɹ֤੡඼ݻ༗ͷίϚϯυΛ֮͑Δඞཁ͕ͳ͍ʣ • ؆୯ʹJOBʹ૊ΈࠐΜͩΓ͢Δ͜ͱ͕Մೳ

    • ࢥཱ͍ͬͨͱ͖ʹ͙͢Πϯϑϥͷૢ࡞͕Ͱ͖Δ • Ϛϧνϕϯμʔͳ؀ڥͰ΋Ϣʔβ͸ҙࣝ͠ͳ͍ ͜Μͳײ͡ͰͷϧʔλɾεΠονɾϩʔ υόϥϯαʔɺNeutronͷઃఆ͕Ͱ͖ Δɻ Regionͷ֓೦΋͍࣋ͨͤͯ·͢
  6. Okinawa Open Days 2016 αʔϏεϝχϡʔ • ৽نαʔϏε্ཱ͕͕ͪΔ͝ͱʹ૿͑Δ΋ ͷ΍ૢ࡞͢Δ΋ͷΛجຊʹߏ੒ • جװܥͷ࡞ۀ͸ಛఆͷϢʔβݖݶͷΈͰ͠

    ͔৮Εͳ͍Α͏ʹ੍ޚ • αʔϏεϝχϡʔ͸ӈهҎ֎ʹ΋ෳ਺ଘࡏ • DC಺ͷϩʔΧϧϨϙδτϦ͔Β഑෍
  7. ߏ੒Πϝʔδͱ࢖༻ٕज़ Okinawa Open Days 2016 • ݴޠ Python Shell Script

    • ιϑτ΢ΣΞ ɹ Flask Nginx Gunicorn ͦͷଞ API Server ग़లɿhttps://dzone.com/articles/learn-python-overtakes-learn-java "Learn Python" Overtakes "Learn Java" on Google Trends ೝՄɾೝূ REST API REST API REST API SSH command ଞʹ͸ɾɾɾ
  8. @api.route('/pool/<poolname>/member', methods=['POST']) def poolmemberpost(poolname): if not request.json: abort(400) if 'name'

    not in request.json: abort(400) return b.memberpost(g.bigip_partition, poolname, request.json) • apiΛϧʔςΟϯά͢Δ͚ͩͷ΋ͷ͸ͦͷ··ྲྀ͢ɻՃ޻͕ඞཁͳ΋ͷ ͸ɺదٓσʔλͷ append ΍ ਖ਼౰ੑνΣοΫΛ͍ͯ͠Δ • api ඇରԠσόΠεͱ͸ɺ pexpect Λར༻ APIαʔόͷΠϝʔδ • Python ͷ؆қ WEB ΞϓϦέʔγϣϯͰ͋Δ FLASK Λ࢖༻ Okinawa Open Days 2016
  9. APIαʔόͷΠϝʔδ " API αʔόʹ͸֤ϝʔΧʔͷૢ࡞༻ͷεΫϦϓτ͕֨ೲ͞Ε͍ͯΔ ྫʣneutron ͷ port list / port

    show / port update Λ·ͱ·ͨ΋ͷ ɹɹL3 SW΁ͷΞΫηεϦετ౤ೖͱΞυϨενΣοΫΛ࣮ߦ͢Δ΋ͷ " GitHub (ࣾ಺ Organization) ΁ެ։͠ɺisuue ΍ pull request ϕʔεͰϢʔ β͔Βͷཁ๬ΛऔΓࠐΈ " ݖݶ΋ FLASK ଆͰ؅ཧ͍ͯ͠ΔͨΊɺςφϯτͷ֓೦͕ͳ͍ઃఆઌʹ ʹରͯ͠΋ݖݶΛ֬ೝ͠ద੾ͳૢ࡞͚ͩʹ੍ݶ͍ͯ͠Δ " API Λެ։͢Δ͚ͩͩͱؾܰʹར༻ͯ͠΋Β͑ͳ͍ͨΊɺίϚϯυϥΠ ϯπʔϧΛఏڙͯ͠རศੑͷ޲্ΛਤΔ Okinawa Open Days 2016
  10. REST APIͷ࿩ Okinawa Open Days 2016 • Τϥʔॲཧָ͕ ɹɹͳͷͰɺώϡʔϚϯΤϥʔ͞Α͏ͳΒʹۙͮ͘ •

    ωοτϫʔΫΤϯδχΞҎ֎Ͱ΋ૢ࡞͠΍͍͢ ɹɹͳͷͰɺެ։͢Ε͹࢖ͬͯ͘Εͦ͏ • ౰વɺߏ੒؅ཧπʔϧͱ͔ͱ͸ҧ͏ • దࡐదॴͰ࢖͍·͠ΐ͏ ΞϓϦέʔγϣϯϓϩάϥϛϯάΠϯλϑΣʔε (APIɺӳ: Application Programming Interface) ͱ͸ɺιϑτ΢ΣΞί ϯϙʔωϯτ͕ޓ͍ʹ΍ΓͱΓ͢Δͷʹ࢖༻͢ΔΠϯλϑΣʔεͷ࢓༷Ͱ͋Δɻ APIʹ͸ɺαϒϧʔνϯɺσʔλߏ଄ɺΦ ϒδΣΫτΫϥεɺม਺ͳͲͷ࢓ؚ༷͕·ΕΔɻ ग़లɿAPI - ΢ΟΩϖσΟΞ https://ja.wikipedia.org/wiki/ΞϓϦέʔγϣϯϓϩάϥϛϯάΠϯ λϑΣʔε
  11. Okinawa Open Days 2016 • άϥϑΟΧϧͳ෦෼͸ChatͰͰ͖ΔΑ ͏ʹ͓ͯ͘͠ͱҎ֎ͱศརɻ • “པ·ΕΔଆ” ΋

    ”པΉଆ” ʹऔͬͯ΋ε τϨεϑϦʔ • ଞʹ΋ՄࢹԽͱ؆୯ͳϓϩϏδϣϯͰ ׆༻ • Jobʹ૊ΈࠐΜͩΓ͢ΔՄೳੑ͕͋Δ ΋ͷ͸ɺCLIͳ͍͠͸APIͰఏڙͨ͠ํ ͕Α͍ APIԽ͢ΔͱChatOpsָ͕ʹͳΔ
  12. Okinawa Open Days 2016 • ؂ࢹ͸ Zabbix ͕ࣗಈͰरͬͯ͘Δ • Zabbix͕ϝʔΧ΍໾ׂΛ൑ผͯ͠άϧʔϐϯά͢Δ

    • ωοτϫʔΫ؅ཧऀ͸ DNS ͷొ࿥ͱ ZTP ͷ४උ͚͓ͩͯ͘͠ • όοΫΞοϓͷδϣϒ͸ Jenkins ͕ຖ൩࣮ߦͯ͠ɺ໰୊͋Ε͹ Slack Ͱ௨஌ • όοΫΞοϓର৅͸ Zabbix ͷ API Λ Jenkins ͔Βୟ͍ͯ࠷৽Λऔ ಘ • VLAN ࡞੒ͳͲͷ JOB ΋ Zabbix ͷ࠷৽Λݩʹੜ੒͞ΕΔ ଞʹ΋͜Μͳͱ͜ΖͰAPI͕ɾɾɾ
  13. ۤ࿑ͨ͠ϙΠϯτ Okinawa Open Days 2016 • APIͳ͠ͷػثΛૢ࡞͢Δ৔߹ɺexpectͰରԠͤ͟ΔΛಘͳ͍ ɹɹˠॲཧ్͕தͰࢭ·Δͱ͔ɾɾɾ ɹɹɹෛ୲ʹͳΒͳ͍ఔ౓ͷΤϥʔॲཧΛɻ •

    ໰୊͕͋ͬͨ࣌ͷ੾Γ෼͚ΛͲ͏͢Δ͔ ɹɹˠ DebugΦϓγϣϯΛ࣮૷ɻClientଆͰऔΕΔΑ͏ʹɻ ɹɹɹ APIͷΤϥʔίʔυͱϝοηʔδΛΫϥΠΞϯτଆ΁ग़ྗ • REST APIͷઃܭ ɹɹˠ ૉਓ͕΍ͬͨͷͰԚ͍ɻۤ࿑ͨ͠ํ͕ྑ͔ͬͨϙΠϯτɻ ɹɹɹ ޙչɻ
  14. Θ͔ͬͨ͜ͱ Okinawa Open Days 2016 • ݖݶपΓ͸ࣗ෼Ͱ࡞ͬͨ΄͏͕͍͍ ɹɹˠ ֤ػثͷػೳࠩΛٵऩ͢Δඞཁ͋Γ •

    ঎༻ʹཔΓ͗ͯ͢ϕϯμʔϩοΫΠϯʹͳΒͳ͍Α͏஫ҙ ɹɹˠ ίϯτϩʔϥʔཚཱ΋ͪΐͬͱɾɾɾ • Ͱ΋ࣗ࡞ͰଐਓԽʹ΋஫ҙɻΤϯδχΞʹҰఆͷϨϕϧΛ ɹɹˠ νʔϜ։ൃͰ͖Δ؀ڥΛ
  15. Interop Tokyo 2016 ෭࢈෺తͳ΋ͷͰ͕͢ɾɾɾ • ωοτϫʔΫػثͱͯ͠΋ɺσϓϩΠπʔϧͱͯ͠΋ɺӡ༻πʔϧͱͯ͠΋ɺط੒ ͷιϑτ΢ΣΞΛ׆༻͢Δ͜ͱͰΦʔϓϯͳωοτϫʔΫʹۙͮ͘͜ͱ͕Ͱ͖Δ • ࣮ࡍͷωοτϫʔΫΛ੍ޚ͢Δ૷ஔͷมΘΓʹιϑτ΢ΣΞͰωοτϫʔΫ Λ૊Ήʢϋʔυͱιϑτͷ෼཭ʣ͜ͱ΋͋Δ

    • σϓϩΠपΓͰ͸ɺదٓඞཁͳ࢓૊ΈΛࣾ಺Ͱ࡞ͬͯӡ༻ΛΧόʔ͍ͯ͠Δ έʔε΋͋ΔʢPython෦෼ͰதؒϨΠϠʔ࡞ͬͯHWͷࠩΛٵऩ͍ͯ͠·͢ʣ • Ͳ͜Ͳ͜੡ͷίϯτϩʔϥΛങ͏ͷ͔ɺࣗ෼ͰͦΕͬΆ͍࢓૊ΈΛ࡞Δͷ͔ ͸ɺϙϦγʔ࣍ୈͰ൑அ Okinawa Open Days 2016
  16. ·ͱΊ Okinawa Open Days 2016 • ϨΨγʔͳ؀ڥͰ΋ SDN ͷΑ͏ʹརศੑͷ޲্Λ໨ࢦ͢͜ ͱ͸Մೳ

    • ωοτϫʔΫΑΓ΋αʔόଆͷٕज़ֵ৽͕ਐΜͰ͓ΓɺΦʔ ϓϯͳٕज़Λར༻͍ͯ͠ΔͷͰඇৗʹࢀߟʹͳΔ 5෼ͷख࡞ۀΑΓ15෼ͰίʔυΛॻ͖·͠ΐ͏ ʢͦΜͳ࣌୅ʁʣ Automation is the new skillset that network engineers need to pick up. Much like sysadmins have had to learn how to use new tools like Chef and Puppet, network engineers are learning that they just can't do things manually anymore. With examples in each chapter, this practical book provides you with baseline skills in network programmability and automation, using a range of technologies including Linux, Python, JSON, and XML. No previous knowledge of software development, programming, automation, or DevOps is required.