17MBのフルルートルータ

D02d368f98011616d6a8612af1ca4de5?s=47 nnao45
June 08, 2018

 17MBのフルルートルータ

D02d368f98011616d6a8612af1ca4de5?s=128

nnao45

June 08, 2018
Tweet

Transcript

  1. None
  2. ‣໊લɿԣࢁ ঘ໻ɹ(ฏ੒3೥ 11݄13೔ੜ·Ε) ‣ॴଐɿCyber AgentגࣜձࣾɹΞυςΫຊ෦ɹ5݄1೔ೖࣾ ‣ݱ৬ɿαʔόαΠυͷίʔσΟϯάɺύϒϦοΫΫϥ΢υपΓͷΠϯϑϥ୲౰ɻ ‣લ৬ɿ๭Ϋϥ΢υϕϯμʹͯɺόοΫϘʔϯωοτϫʔΫ։ൃɺӡ༻ɻ ‣લʑ৬ɿ๭ΩϟϦΞʹͯɺPBB,EVPN,MPLS,VXLANपΓͷݚڀ։ൃɻ ‣঎ࡐɿฐࣾͷαʔόαΠυΛ΍Β͍ͤͯͨͩ͘༧ఆɻ ‣ٕज़ɿBGPɺEVPNɺGoݴޠɺScalaɺ

    kubernetesɺrancher ‣Githubɿ https://github.com/nnao45ʢશ෦GoͰ͢সʣ ‣ओͳίϯτϦϏϡʔτɿosrg/gobgpɺfuture-architect/vulsɺskycoin/skycoin….etc ‣ओͳࣗ࡞ιϑτɿpexpo…λʔϛφϧͰExping(ʮgo pingʯͱݕࡧ͢Δͱग़·͢) jgob…gobgpΛREST HTTP APIԽ͢ΔϑϨʔϜϫʔΫ @nnao45 https://nathany.com/go-testing-toolbox/
  3. @nnao45 ͷ ͸ https://speakerdeck.com/komeiy/cyberagent-adtech-network-for-these-3years

  4. @nnao45 https://speakerdeck.com/komeiy/cyberagent-adtech-network-for-these-3years ݱ৔Ͱͷ ਅ໘໨ͳ࿩ ͨͩͷ झຯͷ࿩ ྃ͝ঝ ͍ͩ͘͞

  5. http://www.kamishihoro.info/sg_detail.php?id=1

  6. http://www.kamishihoro.info/sg_detail.php?id=1

  7. http://www.kamishihoro.info/sg_detail.php?id=1

  8. http://www.kamishihoro.info/sg_detail.php?id=1

  9. https://elbruno.com/2016/06/23/podcast-introduction-to-containers-thanks-docker-spanish/

  10. None
  11. http://bgp.potaroo.net 70ສܦ࿏Λ௒͑Δ੎͍ʂ

  12. ޿ใ ग़དྷͪΌ͏ ͥΜͿ ϑϧϧʔτ ϧ ʔ λ ʔ ੈքͷ*1ΞυϨεΛ

  13. ෺ཧ૚ σʔλϦϯΫ૚ ωοτϫʔΫ૚ τϥϯεϙʔτ૚ ηογϣϯ૚ ϓϨθϯςʔγϣϯ૚ ΞϓϦέʔγϣϯ૚ ਤ̍.TCP/IP 10૚Ϟσϧʢཁग़యʣ ƐƆƋƲ✣Ųƾȉǎǡǹ✣Ƌ࿽ūƓŶƑ⯥ƃƐ

    ź Χω૚ Ϟϊ૚ ώτ૚
  14. CI/CDͷલʹͦ΋ͦ΋ςετॻ͚΍ɻ ੈ͸·͞ʹେίϯςφʔ࣌୅www ͸Φϫίϯ Ansible͸όʔδϣϯ2.6ͰmerakiϞδϡʔϧʹରԠɻ ͜Ε͔Β͸ػցֶ ↑ϋΠϋΠࣗԋԵ VimVimVimVimVimVimVimVimVimVimVimVimVimVimVimVim kubernetes࠷ߴ gVisorͱ͔͕ࠓ͸ྲྀߦΓΒ͠ EmacsEmacsEmacsEmacsEmacsEmacsEmacsEmacsEmac

    ͦΕGitlabͰ΍Ε͹ʁ ࣮ࡍֶशϞσϧ͑͋͞Ε͹ޙ͸Ϧιʔε͔ͩ keynoteͰΞχϝֆͬͯҾ͖·͔͢ ίϯςφʹ͢ΔඞཁͶʔͩΖw C++ͷ࣍͸Rustɻҟ࿦͸ ͳ Μ ͔ ஌ Β Μ ϒϩοΫνΣʔϯ͸ ͚ Ͳ प Γ ͷ ք ۾ ͸SREͱͯ͠ؤுΓ·͢ ͸ ੌ ͍ ͳ ͊ ·ͨόζϫʔυ͔Αɻ vimrcॻ͍ͯҰ೔ऴΘͬͨɻ ΩζφΞΠٕͬͯज़
  15. None
  16. • اۀͱͯ͠࢖͏৔߹ɺ৭ʑ΍Δ࣌ʹ৭ʑɾɾɾɻ • σʔλϓϨʔϯपΓͰ੍໿͕େ͖͍ɻ • τϨʔχϯά༻్ʹݶఆ͞ΕΔʢͱࢥ͍ͬͯΔʣɻ • ࠓͷ୅දతͳNWٕज़͸ރΕ͖ͬͯΔ͠ɺຊ൪؀ڥͰCLIૢ࡞͢ΔͳΒखࠒͳϧʔλͰ͍͍ɻ • OSΛLinuxͰબͿͱ͍͏͚ͩͰΞυόϯςʔδΛಘΕΔػձ͸ͦ͏େ͖͘͸ͳ͍ɻ

    • σʔλϓϨʔϯͲ͏͢Δ໰୊ɻ • ѻ͏ͷʹඞཁͳεΩϧηοτ͕Ψν੎޲͚͗͢Δɻ • ͲͪΒ͔ͱ͍͏ͱ૊ΈࠐΈΤϯδχΞ޲͚ͱ͑͞ࢥ͑Δɻ • ͦ͜·ͰΨνͰ΍Δͷ͸ཁ݅͸தʑͳ͍͔΋ʢۚ༥ܥͷΫϥ΢υNWͰ͸Ձ஋ߴ͍ͱࢥ͏ʣɻ .FSBLJƋŮƥ%ǭȂ✣ȉƒ$16⥦৘ƃźaໃটƑťƮ࠯ℿƃƋනũb OFUOTƋ❣ƶƊaƋƉƥŭൗὐƎƍƆƉŧơżč睬ȼ睬Ď ŶƯƥἠದ০ႨƋŮaƄƪƆƋźƂὨି⃷⃾ƊƒਅŲ൐ƲƯơżƫƐb ※શͯݸਓతͳҙݟͳͷͰɺ ܰ͘ฉ͖ྲྀ͍ͯͩ͘͠͞ =Ǫȉdzȉǧȉdzȉ̇
  17. • اۀͱͯ͠࢖͏৔߹ɺ৭ʑ΍Δ࣌ʹ৭ʑɾɾɾɻ • σʔλϓϨʔϯपΓͰ੍໿͕େ͖͍ɻ • τϨʔχϯά༻్ʹݶఆ͞ΕΔʢͱࢥ͍ͬͯΔʣɻ • ࠓͷ୅දతͳNWٕज़͸ރΕ͖ͬͯΔ͠ɺຊ൪؀ڥͰCLIૢ࡞͢ΔͳΒखࠒͳϧʔλͰ͍͍ɻ • OSΛLinuxͰબͿͱ͍͏͚ͩͰΞυόϯςʔδΛಘΕΔػձ͸ͦ͏େ͖͘͸ͳ͍ɻ

    • σʔλϓϨʔϯͲ͏͢Δ໰୊ɻ • ѻ͏ͷʹඞཁͳεΩϧηοτ͕Ψν੎޲͚͗͢Δɻ • ͲͪΒ͔ͱ͍͏ͱ૊ΈࠐΈΤϯδχΞ޲͚ͱ͑͞ࢥ͑Δɻ • ͦ͜·ͰΨνͰ΍Δͷ͸ཁ݅͸தʑͳ͍͔΋ʢۚ༥ܥͷΫϥ΢υNWͰ͸Ձ஋ߴ͍ͱࢥ͏ʣɻ .FSBLJƋŮƥ%ǭȂ✣ȉƒ$16⥦৘ƃźaໃটƑťƮ࠯ℿƃƋනũb OFUOTƋ❣ƶƊaƋƉƥŭൗὐƒƍƆƉŧơżč睬ȼ睬Ď ŶƯƥἠದ০ႨƋŮaƄƪƆƋźƂὨି⃷⃾ƊƒਅŲ൐ƲƯơżƫƐb ※શͯݸਓతͳҙݟͳͷͰɺ ܰ͘ฉ͖ྲྀ͍ͯͩ͘͠͞ =Ǫȉdzȉǧȉdzȉ̇ ࠓ೔ͷൃදͰ͸ɺ ͜ΕΒͱ͸ผͷΞϓϩʔνͰ /8Λ΋ͬͱ༡΂ΔΑ͏ʹ͠·͢ ࠇຐज़ʹ๋͛Δ୅ঈ͸ίʔυɾɾɾʁ w w w
  18. None
  19. None
  20. None
  21. GoBGP ✓/55ൃͷΦʔϓϯιʔειϑτ΢ΣΞ ✓(PݴޠωΠςΟϒɺฒྻॲཧରԠ ✓31$"1*Λ࢖༻ͯ͠(PݴޠҎ֎͔Β΋֎෦ૢ࡞Մೳ ✓*&5'४ڌͷ̣̬ϓϩτίϧ࣮૷ɺ&71/ɺ7Y-"/༗ ✓ϥΠϒϥϦͱͯ͠࢖༻͢Δࣄ΋Ͱ͖Δɻ https://osrg.github.io/gobgp/

  22. https://www.docker.com/ ✓͍·΍ɹɹɹɹɹɹɹɹɹɹɹɹɹɹɹɹɹɻ ✓(PݴޠͰ΄ͱΜͲॻ͔Ε͍ͯΔɺίϯςφʔٕज़ɻ ✓಺แ͍ͯ͠Δͷ͸-JOVYΧʔωϧͷDHSPVQɺOBNFTQBDFɻ ✓ͳΜ͔࠷ۙ͸LVCFSOFUFTͷ࿩͕ଟ͍ɻ ✓࠷ۙϧʔλ΍48΋αϙʔτ͞ΕͯΔ͕ɺ༻్೉͠ա͗ɻ

  23. https://docs.docker.com/develop/ develop-images/multistage-build/ ✓%PDLFS͔Βαϙʔτ͞Εͨ৽ػೳ ࣮͸ ̎ຕॻ͚͹ੲ͔Βग़དྷ͍ٕͯͨ ɻ ✓%PDLFSGJMFʹ̎ͭͷίϯςφΠϝʔδΛࢦఆ͢ ΔࣄͰɺίϯςφʔͷ෼ׂԽΛ௒؆қతʹߦ͏ɻ ✓ίϯςφʔͷ෼ׂԽʹΑΓɺΑΓۃখͳΠϝʔδ Λ࡞੒͢ΔͷΛՄೳͱͳΔɻ

  24. FROM golang:latest WORKDIR /go/src/github.com/alexellis/href-counter/ RUN go get -d -v golang.org/x/net/html

    COPY app.go . RUN CGO_ENABLED=0 GOOS=linux go build -a -installsuffix cgo -o app . FROM alpine:latest RUN apk --no-cache add ca-certificates WORKDIR /root/ COPY --from=0 /go/src/github.com/alexellis/href-counter/app . CMD ["./app"] Dockerfile https://docs.docker.com/develop/develop-images/multistage-build/#use-multi-stage-builds
  25. None
  26. (1)ίϯιʔϧ͔ΒʮHPCHQHMPCBMSJCBEEʯ౳ɺ$-*ૢ࡞ɻ (2)H31$ܦ༝ͰQZUIPOͱ͔$ ͱ͔࢖ͬͯ"1*Λୟ͖ʹߦ͘ɻ (3);FCSB2VBHHBͱ͔֎෦ιϑτͱ࿈ܞͯ͠$ϓϨʔϯͱͯ͠࿈ܞɻ (4)(P#(1Λ(PݴޠͷϥΠϒϥϦͱͯ͠࢖༻ͯ͠ɺಠࣗͷϧʔλΛ࡞Δɻ

  27. (1)ίϯιʔϧ͔ΒʮHPCHQHMPCBMSJCBEEʯ౳ɺ$-*ૢ࡞ɻ (2)H31$ܦ༝ͰQZUIPOͱ͔$ ͱ͔࢖ͬͯ"1*Λୟ͖ʹߦ͘ɻ (3);FCSB2VBHHBͱ͔֎෦ιϑτͱ࿈ܞͯ͠$ϓϨʔϯͱͯ͠࿈ܞɻ (4)(P#(1Λ(PݴޠͷϥΠϒϥϦͱͯ͠࢖༻ͯ͠ɺಠࣗͷϧʔλΛ࡞Δɻ ແ࿦̐൪͕ ΍Γ͚ͯ͐Ͳ Ͳ͜ʹ΋৘ใ ͕Ͷ͑ʂʂʂ

  28. https://gist.github.com/nnao45/942c4e9465387f5fda9227da00495e86

  29. None
  30. ͜ͷൃදͰࢲͳΓʹ࢖͍ํΛ͝঺հͤͯ͞௖͖͍ͨॴଘ Ͱ͍͟͝·͢ɾɾɾɻ Ҿ༻ݩɿਆͷΈͧ஌ΔηΧΠɹɹɹɹɹɹɹɹɹɹɹɹɹɹɹɹɹɹɹɹɹɹɹɹɹɹɹɹhttps://www.shogakukan.co.jp/books/volume/18233

  31. None
  32. https://github.com/nnao45/full-routaas

  33. ./build.sh golang:alpine ϑϧϧʔτ RIB .go bin golang:alpine ※ ※RIB͸ΦϨΰϯେֶͷαʔϏε(http://www.routeviews.org/routeviews/)Λར༻͠·͢

  34. bin ϑϧϧʔτ RIB toml busybody bin ϑϧϧʔτ RIB toml ࣮ߦϑΝΠϧͷϏϧυ

    ߏ੒ઃఆͷϑΝΠϧ MIBϑΝΠϧͷDL golang:alpine root@v-lab:~# docker images REPOSITORY TAG IMAGE ID CREATED SIZE <none> <none> 8596549588c1 42 hours ago 949MB nnao45/full-routaas latest e916b7ff399a 42 hours ago 102MB ※RIBϑΝΠϧ͕ 85MB͋ΔͷͰɺ ίϯςφຊମ͸ 102 - 85 =17MB
  35. FROM golang:alpine AS builder MAINTAINER nnao45 <n4sekai5y@gmail.com> RUN apk update

    && \ apk upgrade && \ apk add git make ADD . $GOPATH/src/app WORKDIR $GOPATH/src/app RUN make dep-install RUN make dep RUN make RUN mkdir /app && \ cp -a $GOPATH/src/app/full-routaas /app && \ cp -a $GOPATH/src/app/config.tml /app && \ cp -a $GOPATH/src/app/rib* /app FROM busybox WORKDIR /root/ COPY --from=builder app . CMD ["./full-routaas"] Dockerfile https://system-admins.ru/vnedrenie-docker/
  36. https://www.analyticsvidhya.com/blog/2017/11/reproducible-data-science-docker-for-data-science/

  37. https://www.analyticsvidhya.com/blog/2017/11/reproducible-data-science-docker-for-data-science/ (1)dockerͱ͔࢖͑ΔͳΜ͔͠ΒͷLinux/UnixαʔόΛ༻ҙ͢Δɻ (2)git clone https://github.com/nnao45/full-routaas.git͢Δɻ (3)͓खݩͷ؀ڥʹซͤͯconfig.tmlΛมߋ͢ΔʢAS൪߸ͱ͔ʣɻ (4)./build.sh͢Δɻ

  38. https://www.analyticsvidhya.com/blog/2017/11/reproducible-data-science-docker-for-data-science/ #show bgp ipv4 unicast summary Wed Apr 22 16:13:33.503

    JST BGP router identifier XX.XX.XX.XX, local AS number XXXXX BGP generic scan interval 60 secs Non-stop routing is enabled BGP table state: Active Table ID: 0xe0000000 RD version: 205 BGP main routing table version 205 BGP NSR Initial initsync version 51 (Reached) BGP NSR/ISSU Sync-Group versions 0/0 BGP scan interval 60 secs BGP is operating in STANDALONE mode. Process RcvTblVer bRIB/RIB LabelVer ImportVer SendTblVer StandbyVer Speaker 205 205 205 205 205 0 Neighbor Spk AS MsgRcvd MsgSent TblVer InQ OutQ Up/Down St/PfxRcd XX.XX.XX.XX 0 XXXXX 2573601 58 112 0 0 00:01:26 696234 # time docker push ϩʔΧϧNWͷ΄͛΄͛:5000/nnao45/full-routaas The push refers to repository [XX.XX.XX.XX:5000/nnao45/full-routaas] 095a50fd17f7: Pushed 0314be9edf00: Pushed latest: digest: sha256:6080de0f02b50874926472ab2fca62d4d9746866 ca9dd4263991d569b264c952 size: 739 real 0m3.598s user 0m0.080s sys 0m0.020s 1෼26ඵͰ70ສܦ࿏ऑ޿ใʂʂ ϓϥΠϕʔτϨϙδτϦʹ docker pushɺΘ͔ͣ4ඵʂʂ
  39. https://www.analyticsvidhya.com/blog/2017/11/reproducible-data-science-docker-for-data-science/ ‣Goݴޠ͕ు͖ग़͢όΠφϦΛ࣮ߦ͢ΔͷʹɺGoͷ։ൃ؀ڥ͸ඞཁͳ͍ɻ ‣GoBGPΛϥΠϒϥϦͱͯ͠࢖͑͹ɺϢʔβ͕GoBGPͷཉ͍͠ػೳ͚ͩΛ੾Γ ग़ͯ͠ɺͦͷཉ͍͠ػೳ͚ͩΛ࣮ߦͤ͞ΔίϯςφΛ࡞੒Ͱ͖Δɻ ‣GoBGPͷωοτϫʔΫػೳ͸ɺGoݴޠͰϐϡΞʹॻ͔Εͨ΋ͷͱҰൠతͳ LinuxΧʔωϧʹ৐͍ͬͯΔػೳΛϥούʔͯ͠࢖͍ͬͯΔҝɺ΋͏ίϯςφʔ ͱͯ͠͸΄΅Կ΋৐͍ͬͯͳ͍࣮ߦΠϝʔδͱͯ͠busyboxΠϝʔδΛ࢖͑͹ े෼ɻ

  40. LDFLAGS := -ldflags="-s -w -X \"main.version=$(VERSION)\" -extldflags \"-static\"" $(TARGET): $(SRCS)

    CGO_ENABLED=0 GOOS=linux go build -a -tags netgo -installsuffix netgo $(LDFLAGS) -o $(NAME) Go 1.4Ҏ߱͸σϑΥϧτͰͷϏϧυ࣌ʹɺ netύοέʔδ͕dynamic linkԽʂ ὎static linkԽͰෳ਺؀ڥͰಈ͘ΞϓϦʹ͠Α͏ɻ ὎MakefileͰ؅ཧ͕΍͸Γศརɻ ὎ϥΠϒϥϦଆͰ࢖ͬͯΔ࣌͸LDϑϥά΋ཱͯ·͠ΐ͏ˑ ζ*’Ϫ')ζ Makefile https://www.analyticsvidhya.com/blog/2017/11/reproducible-data-science-docker-for-data-science/
  41. https://www.analyticsvidhya.com/blog/2017/11/reproducible-data-science-docker-for-data-science/ https://www.slideshare.net/tetsu.koba/linuxinitgolang?ref=https://gocon.connpass.com/event/82515/presentation/

  42. None
  43. None
  44. None
  45. ✓35#)ϧʔλʜ#(1͑͞࿩ͤΕ͹ɺѼઌOVMMͷTUBUJDϧʔτΛ࠶഑෍͍ͯ͠Δ͚ͩɻ ✓ϑϧϧʔταʔόʜ3*#͑͋ͬͯ͞#(1͕޿ใग़དྷͯ/&95)01ଐੑม͑ΕΕ͹͍͍ɻ ✓#(1'MPXTQFDϧʔλʜ'MPXTQFD͑͞࿩ͤΕ͹ SZ ✓ϓϩτίϧͷ࢓༷͚ͩݟ͍ͨʜOFUOTͰ࡞ͬͯίϯςφΠϝʔδͰݻΊ͓͚ͯ͹͍͍ɻ ✓-*41Ϛοϓαʔόʜ-*41͑͞࿩ͤΕ͹ɺ͋ͱ͸%#ͷνϡʔχϯάؤுΕ͹ SZ ✓#.1ϧʔλʜ#.1͑͞࿩ͤΕ͹ SZ

  46. Hard Ware OS App Configuration ͜͜ΛϓϩάϥϚϒϧʹ ͢Δ࿩͸͍ͬͺ͍͋Δɻ

  47. Hard Ware OS App Configuration Ͱ΋ͦΖͦΖɺ΋ͬͱίʔυͰॻ͚Δ ؀ڥ͸޿͕Γͭͭ͋Δͱײ͡Δ ✖

  48. Կ͔͠ΒͷΠϯλʔϑΣΠε Network Library Hard Ware Docker Engine ࣮ߦΠϝʔδͷখܕԽ=ϙʔλϏϦςΟ APIΛίʔυͰૢ࡞=ػೳ΍௨৴Λॎʹ੍ݶ ίϯςφʹΑΔΠϝʔδ؅ཧ

    =֤ػೳͷΠϛϡʔλϒϧԽ MSBʹΑΔ։ൃͱ࣮ߦ؀ڥͷ෼཭ =αʔϏεͷϚΠΫϩԽʹΑΓɺ ΦϖϨʔγϣϯϛεͷݮগ API(ૢ࡞͍ͨ͠ػೳ͚ͩίʔσΟϯά) Go Runtime Grpc Server
  49. ※·͡ΞϯηϜ(maji-anthem)…ਅ໘໨ʹਃ্͛ͤͯ͠͞௖͘ͱɺͦΕ͸ࠃՎϨϕϧͷීٴ౓Ͱ͢Ͷɻ ※পͩͶʔ(numa-dane-)…Ұ౓ϋϚͬͯ͠·͏ͱதʑൈ͚ΒΕͳ͍Ͱ͢Ͷɻ ※΍͹ͨʹ͑Μ(yaba-tanien)…ͦΕ͸ΨνͷϚδͰϠό͍Ͱ͢ɻ

  50. New? ※·Μ͡(manji)…௒΍͹͍Ͱ͢ͶιϨɻ ※ΤϞ͍(emo-i)…௒Πέͯ·͢ɻ

  51. None
  52. ͔Β࡞ΔͷͰ͸ͳ͘ɺಓ۩ΛआΓͯ૊ΈཱͯΔͷͰ͋Ε͹खܰʹग़དྷΔɾɾɾʂ w w w w w w w w w

    w https://mojang.com
  53. https://github.com/projectcalico/calico-bgp-daemon

  54. None
  55. None
  56. ※͔ͬ͜ΒϚδͰGoͷίʔυͷ࿩͔͠͠·ͤΜɻ ➡ Go…Google੡ͷฒྻॲཧ΍ϋΠεϐʔυͳॲཧʹڧ͍੩తܕ෇ίϯύΠϧݴޠ ➡ Goroutine…Goݴޠͷฒྻॲཧͷਖ਼ମɺίϧʔνϯͰ͢ɻ ➡ gRPC…ݴޠʹґଘ͠ͳ͍IDLͰଞݴޠͷ΍ΓऔΓΛՄೳͱ͢Δɺ༻͸YAMLͩͷJSONͩͷͷ୅ΘΓɻ ※gobgpͷιʔείʔυ͸ͱͯ΋ΦϒδΣΫτࢦ޲ͳॻ͖ํΛ͍ͯ͠ΔͷͰɺ෼͔Γ΍͍͢Ͱ͢(͋ͱmapܕ ΊͬͪΌ࢖͏)ɻ ΁ʔ΍ͬͯΈ͍ͨͬͯࢥ͍͚ͬͯͨͩͨํ͸ؼͬͨޙɺ

    A Tour of Go(https://go-tour-jp.appspot.com/welcome/1)ΛͲ͏ͧ
  57. 1.·࣮ͣ૷͍ͨ͠ػೳΛܾΊΔʢܦ࿏޿ใɺ੍ޚɺଞαʔϏεͱͷ࿈ܞʜFUDʣ 2.࣮૷͍ͨ͠ػೳ͕HPCHQHMPCBMίϚϯυͰ࣮૷͞Ε͍ͯΔ͔υΩϡϝϯτΛಡΉɻ 3.࣮૷͍ͨ͠ίϚϯυ͕͋Ε͹ɺͦͷίϚϯυ͕ୟ͍͍ͯΔ"1*ͷίʔυΛಡΉɻ 4."1*Λୟ͘ͷʹඞཁͳม਺ΛͲ͏΍ͬͯ࣋ͬͯ͘Δ͔࣮૷΋ؚΊͯιʔεΛಡΉɻ 5.ͱʹ͔͘ॻ͍ͯॻ͍ͯॻ͍ͯςετςετςετςετʜɻ 6.׬੒ʙʙʙ

  58. ϝΠϯͷؔ਺(ผʹmain()Ͱ͋Δඞཁ͸ͳ͍) go gobgp.NewBgpServer().Serve go api.NewGrpcServer(s, ":50051").Serve router-idͱ͔AS൪߸ͱ͔ͦ͜Β΁ΜͷάϩʔόϧͳίϯϑΟάΛηοτ ֤ωΠόʔʹରͯ͠ͷίϯϑΟάΛηοτ ֤APIΛୟ͘gRPCΛॳظԽͯ͠ΫϥΠΞϯτͱͯ͠࢖͏ม਺Λੜ੒ go

    injectMrt(bgpclient, m) ແݶϧʔϓ෦෼ ※full-routaas͸select{}ͰԿ΋΍ͬͯͳ͍͚Ͳɺ ܦ࿏੍ޚΛAPIͱͯ͠֎ग़͢͠ΔͳΒ͜͜Ͱॻ͍͓ͯ͘ײ͡
  59. func bgpdServer() { s := gobgp.NewBgpServer() go s.Serve() g :=

    api.NewGrpcServer(s, ":50051") go g.Serve() global := &config.Global{ Config: config.GlobalConfig{ As: 65000, RouterId: 10.0.0.1, Port: -1, // gobgp won't listen on tcp:179 }, } if err := s.Start(global); err != nil { log.Fatal(err) } //gobgpdαʔϏεΛΰϧʔνϯͰىಈɻ //grpcαʔϏεΛgobgpdαʔϏεʹ ϑοΫͤͨ͞ঢ়ଶͰΰϧʔνϯͰىಈʢΦϓγϣϯʣɻ ͜ΕͰ࣮͸gobgpίϚϯυ͕ซ༻Ͱ͖Δɻ //gobgpdͷάϩʔόϧίϯϑΟάΛઃఆɻ Ͳͷ৔߹΋ɺlocal-asͱrouter-idͱbgpͷϙʔτ͘Β͍͠ ͔ઃఆ͠ͳ͍ͱ͜ΖͩͱࢥΘΕ·͢ɻ https://gist.github.com/nnao45/942c4e9465387f5fda9227da00495e86
  60. n := &config.Neighbor{ Config: config.NeighborConfig{ NeighborAddress: 10.0.0.2, PeerAs: 65000, PeerType:

    config.PEER_TYPE_INTERNAL, }, EbgpMultihop: config.EbgpMultihop{ Config: config.EbgpMultihopConfig{ Enabled: true, MultihopTtl: 255, }, }, AfiSafis: []config.AfiSafi{ { Config: config.AfiSafiConfig{ AfiSafiName: "ipv4-unicast", Enabled: true, }, }, ApplyPolicy: config.ApplyPolicy{ Config: config.ApplyPolicyConfig{ ImportPolicyList: []string{"pd1"}, DefaultImportPolicy: config.DEFAULT_POLICY_TYPE_ACCEPT_ROUTE, }, }, } if err := s.AddNeighbor(n); err != nil { log.Error(err) } } //gobgpdͷωΠόʔίϯϑΟάΛઃఆɻ ΠϝʔδΛҎԼʹॻ͍ͯΈͨɻ Config.Neghborܕ NeighborConfigܕ EbgpMultihopܕ AfiSafiܕ AfiSafiConfigܕ ApplyPolicyܕ AfiPolicyConfigܕ
  61. AddPath() Client DeletePath() GetRib() GetNeighbor() timeout := grpc.WithTimeout(time.Second) conn, rpcErr

    := grpc.Dial("localhost:50051", timeout, grpc.WithBlock(), grpc.WithInsecure()) if rpcErr != nil { log.Fatal("GoBGP is probably not running on the local server ... Please start gobgpd process !\n") log.Fatal(rpcErr) return } client := api.NewGobgpApiClient(conn) //࠶ͼgRPCɻ ͜͜ͷίʔυ͸gobgpͷ֤APIΛͨͨ͘ҝʹɺ gRPCΫϥΠΞϯτΛ৽͘͠ఆ͓͖ٛͯ͠·͢ɻ gRPCͷ֤ଐੑΛ٧ΊࠐΜͩม਺clientΛ࢖͍·Θ͠·͢ɻ TCPͳͷͰGC͸ߟྀͯ͠λΠϜΞ΢τ΋ඞਢͰ͢ɻ
  62. args := []string{"10.45.0.0/24"} path, err := cmd.ParsePath(bgp.RF_IPv4_UC, args) if err

    != nil { fmt.Println(err) os.Exit(1) } for _, p := range []*table.Path{path} { arg := &api.AddPathRequest{ Resource: api.Resource_GLOBAL, VrfId: "", Path: api.ToPathApi(p), } r, err := client.AddPath(context.Background(), arg) if err != nil { fmt.Println(err) os.Exit(1) } var b []byte var u uuid.UUID b = r.Uuid u, err = uuid.FromBytes(b) if err != nil { fmt.Println(err) os.Exit(1) } fmt.Println("Added a route's UUID is, ", u.String()) } CLI string CLI PARSE API //CLIΛύʔε͢ΔAPIΛܦ༝ͨ͠ޙɺ ಘͨPathܕͷม਺ΛgRPCʹแΜͰɺ GoBGPଆʹ౉͢Πϝʔδ //CLIΛύʔε͢ΔAPIΛܦ༝͠ͳ͍ͱܕͱ͔໘౗ gobgpd service grpc service gobgp ops API //ࠨ͸AddPathؔ਺ʹಥͬࠐΜ͍Δɻ VRFͷࢦఆͳΜ͔΋͜͜Ͱ΍Δɻ //ͪͳΈʹGoBGP͸ܦ࿏ͷ؅ཧΛUUIDͰ΍ΕΔɻ (DeletePath()͸UUIDࢦఆ͚ͩͰ̤̠)
  63. r, err := client.GetRib(context.Background(), &api.GetRibRequest{ Table: &api.Table{ Type: api.Resource_GLOBAL, Family:

    uint32(bgp.RF_IPv4_UC), Name: "", }, } if err != nil { fmt.Println(err) os.Exit(1) } t, err := r.Table.ToNativeTable() if err != nil { fmt.Println(err) os.Exit(1) } for _, d := range t.GetSortedDestinations() { var ps []*table.Path ps = d.GetAllKnownPathList() for _, s := range ps { fmt.Println("Show a route's UUID is, ",s.UUID().String()) } } //ࠨ͸GetRibؔ਺ʹಥͬࠐΜ͍Δɻ //CࣾͰݴ͑͹ʮshow ip routeʯͬͯॴ //͜ͷCode͡Ό͋·Γҙຯ͸ແ͍͕ɺ ѼઌͰιʔτͯ͘͠ΕΔؔ਺Λୟ͘ྫɻ //͜͜Ͱಘͨܦ࿏ͷUUIDͱAddPathؔ਺ͰಘͨUUID Λಥ͖߹Θͤ͹ਖ਼ৗʹಈ࡞͍ͯ͠ΔࣄΛ֬ೝͰ͖Δɻ for { //ී௨͸ɺίϯϑΟάͱgRPCΫϥΠΞϯτͷ४උ͕ग़དྷͨΒޙ͸forͷແݶϧʔϓͰೖྗΛ଴ͪड͚ΔɻGoͩͱɺνϟϯωϧͰଞ ͷgoroutine͔Β৘ใΛड͚औΕ͹͍͍ͱࢥ͏ɻ }
  64. ✓ ϧʔςΟϯάςʔϒϧΛͲ͏͢Δͷ͔ߟ͓͑ͯ͘ɻ ➡ ϝϞϦ্Ͱ͋Δ͚ͩͳͷͰɺ࠶ىಈͰফ͑·͢ʢ)8ͱಉ͡ʣɻ ➡ ΋͠ܦ࿏ΛӬٱอ؅͢Δඞཁ͕͋ͬͨ৔߹͸ɺผ్%#Ͱอ؅͢ΔίʔυΛॻ͖·͠ΐ͏ɻ ✓ ΞυϨεͱ͔ͷίϯϑΟάϨʔγϣϯΛNBJO ౳ʹϋʔυίʔυ͸ྲྀੴʹɾɾɾɻ ➡

    UPNM IUUQTHJUIVCDPN#VSOU4VTIJUPNM ͱ͔࢖ͬͯϓϨʔϯςΩετ͔ΒಡΈग़ͦ͏ɻ ✓ σόοΫΛߟ͍͑ͯ͘ ➡ ̣̬ΤϯδχΞతʹ͸ϧʔςΟϯάςʔϒϧͱϩάͩΖ͏͕ɺʮ(Pݴޠʯͱͯ͠ͷσόοΫ΋ඞਢɻ ➡ ΍ΔͳΒɺ಺෦ެ։"1*ͱͯ͠SVOUJNF3FBE.FN4UBUT ͷ֤छϞδϡʔϧͱSVOUJNF/VN(PSPVUJOF ͸෷͍ग़͠ ͓͍ͯͯάϥϑͰ΋ॻ͚͹Α͍ɻ ✓ '*#ʹ൓өͱ͔ͦ͏͍͏̙ϓϨʔϯपΓ͸ଞͷιϑτ΢ΣΞͱ࿈ܞͤ͞ͳ͍ͱμϝͰ͢ɻ ➡ ࠓճͷΑ͏ͳ࢖͍ํͰ͸$ϓϨʔϯ୯ಠͷίϯτϩʔϥతͳ࢖͍ํ͕޲͍͍ͯΔؾ͕͠·͢ɻ
  65. HACKER PM/PL サイバーエージェントでは エンジニアを募集しております. ※k8s,OpenStack,AWS,GCP触れるよ. http://rickandmorty.wikia.com/wiki/File:Rick_and_morty_wanted.png

  66. http://www.kill-la-kill.jp/blu-ray_dvd/04.html ΩϧϥΩϧ Blu-ray &DVD શ̕רൃചதʂ ΩϧϥδΣωϨʔλʔ http://wakufactory.jp/html5/ webfont/killla.html