1 Copyright © 2016 Juniper Networks, Inc. www.juniper.net
JUNOS AUTOMATION その1
~OVERVIEW & PYEZ ~
Regional PLM/TME 塚本 広海
2016/10/27
NetOpsCoding #4
2 Copyright © 2016 Juniper Networks, Inc. www.juniper.net
LEGAL STATEMENT
This statement of direction sets forth Juniper
Networks’ current intention and is subject to
change at any time without notice. No purchases
are contingent upon Juniper Networks delivering
any feature or functionality depicted in this
presentation
3 Copyright © 2016 Juniper Networks, Inc. www.juniper.net
ジュニパーネットワークス
SECURITYSWITCHINGROUTING
PERFORMANCE
AUTOMATION
4 Copyright © 2016 Juniper Networks, Inc. www.juniper.net
THE NEXT TRANSFORMATION IN NETWORKING
TCP/IP
EARLY 1980’S LATE 1990’S TODAY
PACKET
FORWARDING
ENGINE
AUTOMATION
ONLINEPOPULATION:
Tens of Thousands
ONLINE POPULATION:
Hundreds of Millions
ONLINE POPULATION:
Billions
5 Copyright © 2016 Juniper Networks, Inc. www.juniper.net
6 Copyright © 2016 Juniper Networks, Inc. www.juniper.net
AUTOMATION - CATEGORY
Domain Automation
Network Automation
Platform Automation
<SLAX>
7 Copyright © 2016 Juniper Networks, Inc. www.juniper.net
AUTOMATION – WW USER PYRAMID
SP Tier 1SP Tier 1
SP Tier 2/3SP Tier 2/3
ENT – FinancialENT – Financial
ENT – Federal/PublicENT – Federal/Public
ENT – StrategicENT – Strategic
ENT – Other EnterprisesENT – Other Enterprises
OTT
Web 2.0
API/programmable
積極的開発
開発消極的
シンプルなツール活用
8 Copyright © 2016 Juniper Networks, Inc. www.juniper.net
DC
DC
EdgeCoreEdge
AUTOMATION - DOMAIN
Access
Aggregation
9 Copyright © 2016 Juniper Networks, Inc. www.juniper.net
DC
DC
EdgeCoreEdge
JUNIPER AUTOMATION DOMAIN & MANAGEMENT
Access
Aggregation
Security Director
Network Director
Connectivity Services Director
Edge Services
Director
Northstar ControllerNorthstar Controller ContrailContrail
Contrail ServiceContrail Service
Orchestrator
オンボックス & オフボックス
オートメーションの提供
SPACE
10 Copyright © 2016 Juniper Networks, Inc. www.juniper.net
11 Copyright © 2016 Juniper Networks, Inc. www.juniper.net
 Programmable Interface(API)
 Structured operation data(JSON,XML)
 Device configuration in structured format(JSON,XML)
 Atomic configuration changes
 Configuration Rollback
 Configuration Replace
 Configuration Diff
 Support for industry-standard models (IETF, OpenConfig)
NETWORK AUTOMATION RFP REQUIREMENTS
All Pass : JUNOS
12 Copyright © 2016 Juniper Networks, Inc. www.juniper.net
JUNOS
AUTOMATION
STACK
13 Copyright © 2016 Juniper Networks, Inc. www.juniper.net
Data Plane (PFE)Chassis
XML-RPC
NETCONF Junoscript
SNMP
RO
Junos Platform Automation
Stack
PyEZ Framework
Ansible
Python
Scripts
Python
Scripts
Salt*
RubyEZ Library
Puppet
Ruby
Scripts
Ruby
Scripts
Chef
Python / SLAX
CLIRA*CLIRA*JSNAPJSNAP
THRIFT
JET API
REST CLI
jVision
Sensor
JUNOS AUTOMATION STACK
14 Copyright © 2016 Juniper Networks, Inc. www.juniper.net
STAGES OF AUTOMATION IN NETWORKING
構築
設定運用
15 Copyright © 2016 Juniper Networks, Inc. www.juniper.net
PROGRAMMATIC CONTROL & AUTOMATION
構築 設定
ZTP
運用
Netconify
OpenClos
OpenConfig
Netconf/Restful
PyEZ
Ansible
Puppet
Chef
Ansible
OpenConfig
Junos Telemetry
Netconf
Message Bus
JSNAP
Junos Script
PyEZ
16 Copyright © 2016 Juniper Networks, Inc. www.juniper.net
シンプルに
JUNOSを操作する
オープンソース Pythonライブラリ
”Built for the networking engineer”
PyEz
17 Copyright © 2016 Juniper Networks, Inc. www.juniper.net
PYTHONEZ FRAMEWORK
Build Simple to Complex Applications
IT FrameworksPython Shell Python script
Custom
Applications
Open Source – Maintained by CommunityNETCONF Client (NCCLIENT)
NETCONF TRANSPORT ONLY VENDOR AGNOSTIC NO ABSTRACTIONS
Open Source – Maintained by Juniper
"snippets"
(no variables)
"templates"
(merge variables)Resources Tables
Configuration Changes Operational State
Junos Python EZ (Junos PyEZ)
JUNOS SPECIFIC ABSTRACTION LAYER MICRO-FRAMEWORK
Views
18 Copyright © 2016 Juniper Networks, Inc. www.juniper.net
情報取得
設定変更
OS
ユーティリティ
マネージメント
ユーティリティ
• 事前定義された基本情報 facts
• YAML定義のTable and View
• RPCによるshowコマンド
• Config ASCII text, junos setコマンド, XML,
• Jinja2 Template objectsテンプレートベース
• OS インストール、再起動、シャットダウン etc
• コンフィグ比較、レスキューコンフィグ、
コンフィグ変更のアップetc
PyEZ でできること
19 Copyright © 2016 Juniper Networks, Inc. www.juniper.net
少ないコード数で簡単に
Raw python – 48行 PyEz– 7行
show version取得 – factsサンプル-
import paramiko
import socket
import time
import sys
ssh = paramiko.SSHCient()
ssh.set_missing_host_key_policy(
paramiko.AutoAddPolicy())
CLOSE = """
<rpc>
<close-session/>
</rpc> """
SOFT_ADD = """
<rpc>
<get-software-information/>
<rpc/>"""
socket = socket.socker(socket.AF_INET,socket.SOCK_STREAN)
socket.connect(("10.10.11.129",830))
trans = paramiko.Transport(socket)
trans.connect(username="xxx", password="xxx")
#CREATE CHANNEL FOR DATA COMM
ch = trans/open_session()
name = ch.set_name('netconf')
#Invoke NETCONF
ch.invoke_subsystem('netconf')
#SEND_COMMAND
cf.send(SOFT_ADD)
#Receive data returned
data = ch.recv(2048)
while data:
data = ch.recv(1024)
print data,
if data.find('</rpc-reply>') == 0:
#we have reached the end of reply
ch.send(CLOSE)
ch.close()
trans.close()
socket.close()
from jnpr.junos import Device
from jnpr.junos.op.routes import
RouteTable
dev = Device(host='10.0.0.243',
user='vsrx', password='srx123',
port='22')
dev.open()
print(dev.facts)
20 Copyright © 2016 Juniper Networks, Inc. www.juniper.net
1. JUNOS verup
2. Config変更
(setコマンド読込)
3. Routing table情報
(Table and View活用)
PyEzサンプル
21 Copyright © 2016 Juniper Networks, Inc. www.juniper.net
ユースケース1:誰でも使えるWEBアプリ
機器の一覧表示と、showコマンド等の実行
設定一括投入
OSインストール
サポート情報(RSI)取得結果の一覧
OSイメージ管理
• 誰でも簡単に情報取得が可能。
• Vlan追加などの定型設定追加など。
22 Copyright © 2016 Juniper Networks, Inc. www.juniper.net
ユースケース2 : ノード追加時の設定テンプレート
system {
host-name switch-14-02-42-01;
domain-name mycorp.net;
backup-router 10.176.31.1 destination 10.0.0.0/8;
time-zone America/Los_Angeles;
}
Junos Configuration
system {
host-name ${Hostname};
domain-name mycorp.net;
backup-router ${BackupRouter}
¥destination 10.0.0.0/8;
time-zone ${TimeZone};
}
Config Template
Template
Repository
Expert
1.
新規ノード
Hostname: NEW-NODE
BackupRouter: 10.176.31.2
TZ: Tokyo/Japan
新ノード情報
エキスパートが
商用Configを作成
JINJA2テンプレートで
templateを作成
新規ノード追加時、
テンプレートと固有情報から
Configを簡易に生成
1
2
3
Non-expert
2.
3.
23 Copyright © 2016 Juniper Networks, Inc. www.juniper.net
ユースケース3:外部システム連携
Security Routing Switching
24 Copyright © 2016 Juniper Networks, Inc. www.juniper.net
CUSTOMER AUTOMATING
HISTORICAL Currently In the future…
Monitoring
特定箇所の監視
Installation
コンソールの解放
Upgrades
設定追加
Provisioning
繰返しからの解放
This slide is not an accurate description of all our customers as we have customer who do not automate at all and others who live in a culture where
everything should be automated. This slide is meant to show trends and where the tipping point in automation is at today.
Orchestration
ドメインの拡大
DevOps
即時評価&展開
Autonomous
自己回復,予兆検知
25 Copyright © 2016 Juniper Networks, Inc. www.juniper.net
* Based on queries posted by their employees on Google Group
PyEZ users*
26 Copyright © 2016 Juniper Networks, Inc. www.juniper.net
PyEZリファレンス
Github :
Pyez-examples
O’REILLY Book
https://github.com/vnitinv/pyez-examples
Google group
Junos Python EZ
http://forums.juniper.net/t5/Automation/Where-can-I-learn-more-about-Junos-PyEZ/ta-p/280496
TechWiki
Youtube
PythonEZ (PYEZ) – BasicsJuniper doc
27 Copyright © 2016 Juniper Networks, Inc. www.juniper.net
SUMMARY
JUNIPER ♥ Automation & NetOps
活用事例やJunos automationの期待など
意見交換、発表 お願いします
28 Copyright © 2016 Juniper Networks, Inc. www.juniper.net
イベント告知
OpenContrail Meet-Up
12月初旬に実施予定
LT募集
29 Copyright © 2016 Juniper Networks, Inc. www.juniper.net
END

161027 net opscoding-junos-automation

  • 1.
    1 Copyright ©2016 Juniper Networks, Inc. www.juniper.net JUNOS AUTOMATION その1 ~OVERVIEW & PYEZ ~ Regional PLM/TME 塚本 広海 2016/10/27 NetOpsCoding #4
  • 2.
    2 Copyright ©2016 Juniper Networks, Inc. www.juniper.net LEGAL STATEMENT This statement of direction sets forth Juniper Networks’ current intention and is subject to change at any time without notice. No purchases are contingent upon Juniper Networks delivering any feature or functionality depicted in this presentation
  • 3.
    3 Copyright ©2016 Juniper Networks, Inc. www.juniper.net ジュニパーネットワークス SECURITYSWITCHINGROUTING PERFORMANCE AUTOMATION
  • 4.
    4 Copyright ©2016 Juniper Networks, Inc. www.juniper.net THE NEXT TRANSFORMATION IN NETWORKING TCP/IP EARLY 1980’S LATE 1990’S TODAY PACKET FORWARDING ENGINE AUTOMATION ONLINEPOPULATION: Tens of Thousands ONLINE POPULATION: Hundreds of Millions ONLINE POPULATION: Billions
  • 5.
    5 Copyright ©2016 Juniper Networks, Inc. www.juniper.net
  • 6.
    6 Copyright ©2016 Juniper Networks, Inc. www.juniper.net AUTOMATION - CATEGORY Domain Automation Network Automation Platform Automation <SLAX>
  • 7.
    7 Copyright ©2016 Juniper Networks, Inc. www.juniper.net AUTOMATION – WW USER PYRAMID SP Tier 1SP Tier 1 SP Tier 2/3SP Tier 2/3 ENT – FinancialENT – Financial ENT – Federal/PublicENT – Federal/Public ENT – StrategicENT – Strategic ENT – Other EnterprisesENT – Other Enterprises OTT Web 2.0 API/programmable 積極的開発 開発消極的 シンプルなツール活用
  • 8.
    8 Copyright ©2016 Juniper Networks, Inc. www.juniper.net DC DC EdgeCoreEdge AUTOMATION - DOMAIN Access Aggregation
  • 9.
    9 Copyright ©2016 Juniper Networks, Inc. www.juniper.net DC DC EdgeCoreEdge JUNIPER AUTOMATION DOMAIN & MANAGEMENT Access Aggregation Security Director Network Director Connectivity Services Director Edge Services Director Northstar ControllerNorthstar Controller ContrailContrail Contrail ServiceContrail Service Orchestrator オンボックス & オフボックス オートメーションの提供 SPACE
  • 10.
    10 Copyright ©2016 Juniper Networks, Inc. www.juniper.net
  • 11.
    11 Copyright ©2016 Juniper Networks, Inc. www.juniper.net  Programmable Interface(API)  Structured operation data(JSON,XML)  Device configuration in structured format(JSON,XML)  Atomic configuration changes  Configuration Rollback  Configuration Replace  Configuration Diff  Support for industry-standard models (IETF, OpenConfig) NETWORK AUTOMATION RFP REQUIREMENTS All Pass : JUNOS
  • 12.
    12 Copyright ©2016 Juniper Networks, Inc. www.juniper.net JUNOS AUTOMATION STACK
  • 13.
    13 Copyright ©2016 Juniper Networks, Inc. www.juniper.net Data Plane (PFE)Chassis XML-RPC NETCONF Junoscript SNMP RO Junos Platform Automation Stack PyEZ Framework Ansible Python Scripts Python Scripts Salt* RubyEZ Library Puppet Ruby Scripts Ruby Scripts Chef Python / SLAX CLIRA*CLIRA*JSNAPJSNAP THRIFT JET API REST CLI jVision Sensor JUNOS AUTOMATION STACK
  • 14.
    14 Copyright ©2016 Juniper Networks, Inc. www.juniper.net STAGES OF AUTOMATION IN NETWORKING 構築 設定運用
  • 15.
    15 Copyright ©2016 Juniper Networks, Inc. www.juniper.net PROGRAMMATIC CONTROL & AUTOMATION 構築 設定 ZTP 運用 Netconify OpenClos OpenConfig Netconf/Restful PyEZ Ansible Puppet Chef Ansible OpenConfig Junos Telemetry Netconf Message Bus JSNAP Junos Script PyEZ
  • 16.
    16 Copyright ©2016 Juniper Networks, Inc. www.juniper.net シンプルに JUNOSを操作する オープンソース Pythonライブラリ ”Built for the networking engineer” PyEz
  • 17.
    17 Copyright ©2016 Juniper Networks, Inc. www.juniper.net PYTHONEZ FRAMEWORK Build Simple to Complex Applications IT FrameworksPython Shell Python script Custom Applications Open Source – Maintained by CommunityNETCONF Client (NCCLIENT) NETCONF TRANSPORT ONLY VENDOR AGNOSTIC NO ABSTRACTIONS Open Source – Maintained by Juniper "snippets" (no variables) "templates" (merge variables)Resources Tables Configuration Changes Operational State Junos Python EZ (Junos PyEZ) JUNOS SPECIFIC ABSTRACTION LAYER MICRO-FRAMEWORK Views
  • 18.
    18 Copyright ©2016 Juniper Networks, Inc. www.juniper.net 情報取得 設定変更 OS ユーティリティ マネージメント ユーティリティ • 事前定義された基本情報 facts • YAML定義のTable and View • RPCによるshowコマンド • Config ASCII text, junos setコマンド, XML, • Jinja2 Template objectsテンプレートベース • OS インストール、再起動、シャットダウン etc • コンフィグ比較、レスキューコンフィグ、 コンフィグ変更のアップetc PyEZ でできること
  • 19.
    19 Copyright ©2016 Juniper Networks, Inc. www.juniper.net 少ないコード数で簡単に Raw python – 48行 PyEz– 7行 show version取得 – factsサンプル- import paramiko import socket import time import sys ssh = paramiko.SSHCient() ssh.set_missing_host_key_policy( paramiko.AutoAddPolicy()) CLOSE = """ <rpc> <close-session/> </rpc> """ SOFT_ADD = """ <rpc> <get-software-information/> <rpc/>""" socket = socket.socker(socket.AF_INET,socket.SOCK_STREAN) socket.connect(("10.10.11.129",830)) trans = paramiko.Transport(socket) trans.connect(username="xxx", password="xxx") #CREATE CHANNEL FOR DATA COMM ch = trans/open_session() name = ch.set_name('netconf') #Invoke NETCONF ch.invoke_subsystem('netconf') #SEND_COMMAND cf.send(SOFT_ADD) #Receive data returned data = ch.recv(2048) while data: data = ch.recv(1024) print data, if data.find('</rpc-reply>') == 0: #we have reached the end of reply ch.send(CLOSE) ch.close() trans.close() socket.close() from jnpr.junos import Device from jnpr.junos.op.routes import RouteTable dev = Device(host='10.0.0.243', user='vsrx', password='srx123', port='22') dev.open() print(dev.facts)
  • 20.
    20 Copyright ©2016 Juniper Networks, Inc. www.juniper.net 1. JUNOS verup 2. Config変更 (setコマンド読込) 3. Routing table情報 (Table and View活用) PyEzサンプル
  • 21.
    21 Copyright ©2016 Juniper Networks, Inc. www.juniper.net ユースケース1:誰でも使えるWEBアプリ 機器の一覧表示と、showコマンド等の実行 設定一括投入 OSインストール サポート情報(RSI)取得結果の一覧 OSイメージ管理 • 誰でも簡単に情報取得が可能。 • Vlan追加などの定型設定追加など。
  • 22.
    22 Copyright ©2016 Juniper Networks, Inc. www.juniper.net ユースケース2 : ノード追加時の設定テンプレート system { host-name switch-14-02-42-01; domain-name mycorp.net; backup-router 10.176.31.1 destination 10.0.0.0/8; time-zone America/Los_Angeles; } Junos Configuration system { host-name ${Hostname}; domain-name mycorp.net; backup-router ${BackupRouter} ¥destination 10.0.0.0/8; time-zone ${TimeZone}; } Config Template Template Repository Expert 1. 新規ノード Hostname: NEW-NODE BackupRouter: 10.176.31.2 TZ: Tokyo/Japan 新ノード情報 エキスパートが 商用Configを作成 JINJA2テンプレートで templateを作成 新規ノード追加時、 テンプレートと固有情報から Configを簡易に生成 1 2 3 Non-expert 2. 3.
  • 23.
    23 Copyright ©2016 Juniper Networks, Inc. www.juniper.net ユースケース3:外部システム連携 Security Routing Switching
  • 24.
    24 Copyright ©2016 Juniper Networks, Inc. www.juniper.net CUSTOMER AUTOMATING HISTORICAL Currently In the future… Monitoring 特定箇所の監視 Installation コンソールの解放 Upgrades 設定追加 Provisioning 繰返しからの解放 This slide is not an accurate description of all our customers as we have customer who do not automate at all and others who live in a culture where everything should be automated. This slide is meant to show trends and where the tipping point in automation is at today. Orchestration ドメインの拡大 DevOps 即時評価&展開 Autonomous 自己回復,予兆検知
  • 25.
    25 Copyright ©2016 Juniper Networks, Inc. www.juniper.net * Based on queries posted by their employees on Google Group PyEZ users*
  • 26.
    26 Copyright ©2016 Juniper Networks, Inc. www.juniper.net PyEZリファレンス Github : Pyez-examples O’REILLY Book https://github.com/vnitinv/pyez-examples Google group Junos Python EZ http://forums.juniper.net/t5/Automation/Where-can-I-learn-more-about-Junos-PyEZ/ta-p/280496 TechWiki Youtube PythonEZ (PYEZ) – BasicsJuniper doc
  • 27.
    27 Copyright ©2016 Juniper Networks, Inc. www.juniper.net SUMMARY JUNIPER ♥ Automation & NetOps 活用事例やJunos automationの期待など 意見交換、発表 お願いします
  • 28.
    28 Copyright ©2016 Juniper Networks, Inc. www.juniper.net イベント告知 OpenContrail Meet-Up 12月初旬に実施予定 LT募集
  • 29.
    29 Copyright ©2016 Juniper Networks, Inc. www.juniper.net END