api イントロダクション apic-em, prime infrastructure & cmx

62
APIC-EM, Prime Infrastructure & CMX API イントロダクション 山崎 敦志 ディベロッパーサポートジャパン 2016318

Upload: npsg

Post on 16-Apr-2017

1.335 views

Category:

Engineering


2 download

TRANSCRIPT

APIC-EM, Prime Infrastructure & CMX

API イントロダクション

山崎敦志

ディベロッパーサポートジャパン

2016年3月18日

APIC-EM API

Northbound REST API

APIC-EM ArchitectureAPIC-EM アプリケーション

エラスティックコントローラー基盤 (Grapevine )

ネットワークプラグ&プレイ

QoS (beta) パストレースネットワークインベントリ

トポロジービジュアライザー

APIC-EM Services

インベントリマネージャ

RBAC ポリシー分析 ポリシープログラマー

ネットワークプラグ&プレイ

データアクセスサービス

トポロジーサービス

IWAN

サービス

ベースアプリケーションは標準で付属

ソリューションアプリケーションはライセンスが必要

REST API

コアサービス

アプリケーションに特化したサービス

無停止でのサービス追加に対応

拡張性と可用性を考慮

下位デバイスドライバ スイッチ、ルータ、無線LAN機器等に対応

NE NE NE NE NE スイッチ、ルータ、無線LAN機器等 (Network Element)

アプリケーション (APIC-EM App)

Public Cloud

Enterprise Network

Day 0Plug-and-Play

・ルータ・スイッチ・APのゼロタッチ展開

展開の加速:現地作業員削減、展開時間を月・日レベルから時・分単位へ

Day 1EasyQoS

・ネットワークデバイスへQoSを展開

Day 2Path Trace

・エンドツーエンドで可視化

・トラブルシュートの迅速化

Dymamic QoS

BRANCH

APIC-EMによるデータ収集

5

収集情報 (frequency: every polling interval)

デバイス、インターフェース、リンク、リンク状態 CDP/LLDP/IPデバイストラッキングDB

Wirelessアソシエーション VLAN/STP

HSRP

OSPF, ISIS, EIGRP, BGP, スタティックルート …

SNMPトラップをトリガーに収集する情報

ワイヤレスホスト

APIC-EMNetwork

InformationBase

(NIB)

APIC-EMは周期的にデバイス/ホスト/ルーティングテーブル情報などをネットワーク機器から収集 収集された情報はNIB (Network Information Base)としてAPIC-EMに保存

注意:NIBへ直接アクセスはできない

APIC-EM Discovery

`

CDP or IP Range

SNMPv2/3

CLI Credential

APIC-EM Device Inventory

`

Discovery実行・完了するとDevice/Host Invenrty及びTopology生成

`

APIC-EM Host Inventory

Detailed host information Network attachment point for host

スイッチ:IP Device Tracking、WLAN:SNMP Trap

APIC-EM Topology

Inventory完了後自動生成

プラグアンドプレイ – 構成要素

PnPエージェントルータ、スイッチ、ワイヤレスAPで動作する共通エージェント機能

展開プロセスを自動化

従来のCNSを刷新(2001年に開発)

PnPサーバAPIC-EM上で動作

サイト管理、コンフィグ、デバイスイメージ(IOSなど)、ワークフロー

PnPプロトコル

エージェントとサーバ間で動作

スキーマは公開

クラウドリダイレクトサービス[ オプション ]

(ロードマップ)

プロトコル:オープン

仕様:XMLスキーマ

Open Plug and Play (PnP)

APIC-EMによるPnP

サービス

PnP Agent

Programmer

Open PnP REST API

PnP Agent

Programmer

Open PnP自前PnPサーバ

https://developer.cisco.com/site/open-plug-n-play/

`

Path Trace App

Required Information

ソースIP / デスティネーションIP アドレス(ホスト / L3インターフェース)

Optional Information

ソースポート / デスティネーションポート 番号(TCP / UDP)

`

Path Trace App: アプリフロー可視化

CAPWAP Tunnel

Visualization

Accuracy Note

(in a percentage)

Link Source

Information

Ingress/Egress

Interface

Path Trace App: 該当フローのトポロジ確認

`

`

Path Trace App: 反対方向の確認

EasyQoS

16

/policy/tag

/relevance

/application

Dynamic QoS

17

Dynamic QoS Enabled

Dynamic QoS

Policies

Dynamic QoS

Problem: アプリケーションからのネットワークポリシーのリクエスト

Solution: APIを利用した動的ポリシーの適用

例:

1) オペレータは事前にポリシーを定義

2) アプリケーション側がAPIを使いポリシーの適用、または削除をリクエスト

3) APIC-EMはポリシーリクエストに該当するネットワーク機器へポリシーを適用、または削除し、アプリケーションへ通知

Virtual / Overlay Networks

Network

APIC-EM QoS and ACL Apps

Applications

Application Interfaces – (REST)

reportdeploy

NOC Operators

responserequest managedefine

57

https://<APIC-EM>/api/v1/policy/flow POST

{

"sourceIP" : "172.28.97.54”,

"destIP" : "10.10.10.51”,

"sourcePort" : "30952”,

"destPort" : "22754”,

"protocol" : "tcp”,

"flowType" : "VOICE”,

"averageBandwidth": "64”,

"peakBandwidth": "64”,

"qosClassName": "conversational.audio.avconf.aq",

"appId": "e40d4836-45aa-39b2-e46b-84018b289e15”,

"codec": "g.711u”

}

Dynamic QoS (Voice / Video)

Virtual / Overlay Networks

Network

APIC-EM QoS and ACL Apps

UC Manager

Application Interfaces – (REST)

report3) deploy

NOC Operators

response2) request managedefine

Client B

Client A

1) Client AとClient B間で通話開始

1)

2) あらかじめ定義されているポリシーをAPI経由でリクエスト

3) APIC-EMは該当するネットワーク機器へQoSを適用

4) 通話終了

5) ポリシーの削除をリクエスト

6) APIC-EMがポリシーを削除 58

APIC-EM REST API

APIC-EMのAPIをたたくためにはセッショントークンが必要− トークンを作成するためにticket APIを使う

− ticket API以外はX-Auth-Tokenヘッダーにservice ticketを追加

APIC-EMのREST APIはJSONフォーマット− content-typeヘッダーにapplication/jsonを追加

− パースが容易

APIC-EMのAPIを試す方法− APIC-EM GUI (Swagger)

− Chrome POSTMAN

− プログラミング

http://gblogs.cisco.com/jp/2015/12/getting-started-with-apic-em-rest-1/

http://gblogs.cisco.com/jp/2016/03/getting-started-with-apic-em-rest-2/

Step 1: service ticketをリクエスト

Step 2: service ticket 取得

Step 3: X-Auth-Token ヘッダーに service ticketを追加

APIC-EM REST API on GUI

47DevNet Sandbox: https://sandboxapic.cisco.com:9443/

APIC-EM Northbound REST API

47

Device & Host Inventory API{"id": "7895a45f-47aa-42ee-9d06-c66d3b784594",

"hostname": "SDN-BRANCH-3750-STACK",

"managementIpAddress": "40.0.2.18",

"macAddress": "1C:DF:0F:08:20:C2",

"type": "SWITCH",

"vendor": "Cisco",

"family": "C3750X",

"serialNumber": "FDO1432K0MC",

"platformId": "WS-C3750X-48P",

"softwareVersion": "15.2(1)E2",

"imageName": "c3750e-universalk9-mz.152-1.E2.bin",

"upTime": "26 weeks, 3 hours, 8 minutes",

"memorySize": "262144K",

"interfaceCount": "109",

"role": "Access",

"roleSource": "auto",

"lineCardCount": "5",

"lineCardId": "3220b22a-a74c-4f9e-9898-

c9afc01dc5dd,9ef0da99-963c-4289-9087-7f861c969ea3,e5b911e4-

2c1c-4a95-9214-dd9877dd2b92,f5996432-3c89-4045-ac8b-

46a6bf873845",

"lastUpdated": "2014-09-29 16:19:17.627273-07",

"portRange": "FastEthernet0, Vlan1, GigabitEthernet1/0/1-48,

GigabitEthernet1/1/1-4, GigabitEthernet2/0/1-48,

GigabitEthernet2/1/1-4, TenGigabitEthernet1/1/1-2,

TenGigabitEthernet2/1/1-2",

"avgUpdateFrequency": 300,

"numUpdates": 30,

"reachabilityStatus": "In Progress",

"reachabilityFailureReason": "Unreachable"

},

{

"id": "8f41bef8-698c-4701-af14-471e910ed9ff",

"hostMac": "00:50:56:8A:27:A3",

"hostIp": "40.0.5.12",

"hostType": "WIRED",

"connectedNetworkDeviceId": "7895a45f-47aa-42ee-9d06-

c66d3b784594",

"connectedNetworkDeviceIpAddress": "40.0.2.18",

"connectedInterfaceId": "30bb14c1-8fb6-45c4-8f6d-5b845a7f448c",

"connectedInterfaceName": "GigabitEthernet2/0/2",

"vlanId": "1",

"lastUpdated": "September 29, 2014 1:54:13 PM PDT",

"numUpdates": 1,

"userStatus": "Active",

"source": 200

},

https://<apic-em>/api/v1/host

https://<apic-em>/api/v1/network-device

Interface API

{

"id": "5bcc0bc0-c7bd-458d-9ad6-b606970017cf",

"deviceId": "526c8fc6-f732-41a9-9faf-5876293a2e8c",

"interfaceType": "Physical",

"portName": "GigabitEthernet1/0/5",

"portType": "Gigabit Ethernet",

"portMode": "routed",

"connectorType": "RJ-45",

"macAddress": "18:9C:5D:16:FC:E4",

"ipv4Address": "40.0.3.1",

"ipv4Mask": "30",

"serialNo": "FOC1743X0CJ",

"pid": "WS-C3850-48P",

"status": "down",

"vendor": "Cisco",

"lastUpdated": "2014-09-29 16:17:14.995619-07",

"duplex": false,

"avgUpdateFrequency": 180,

"numUpdates": 49,

"speed": 1000000

}

{

"id": "2fdb927f-a5a7-47b2-bbed-8499c1c12105",

"deviceId": "526c8fc6-f732-41a9-9faf-5876293a2e8c",

"interfaceType": "Physical",

"portName": "GigabitEthernet1/0/4",

"portType": "Gigabit Ethernet",

"portMode": "routed",

"connectorType": "RJ-45",

"macAddress": "18:9C:5D:16:FC:F6",

"ipv4Address": "40.0.2.5",

"ipv4Mask": "30",

"serialNo": "FOC1743X0CJ",

"pid": "WS-C3850-48P",

"status": "up",

"vendor": "Cisco",

"connectedNeighbor": "a632c6e8-89bf-4949-8e4d-a249105f2c7c",

"lastUpdated": "2014-09-29 16:17:14.980705-07",

"connectedNeighborType": "Network_Device",

"ospfSupport": true,

"duplex": true,

"avgUpdateFrequency": 180,

"numUpdates": 49,

"speed": 1000000

}https://<apic-em>/api/v1/interface

Topology Service"nodes": [

{

"deviceType": "WIRED",

"label": "40.0.0.15",

"id": "51a75ce9-d5c9-4fe2-95a0-6fc01410e201",

“nodeType”: “host”, “x": 48, “y": 198, …

},{

"deviceType": "SWITCH",

"label": "SDN-CAMPUS-C3850",

"id": "f8c3fc68-cd26-4576-bcec-51f9b578f71e",

"nodeType": "device", "x": 83, "y": 172, …

}

........

(省略)...........

{

"deviceType": "SWITCH",

"label": "SDN-BRANCH-3750-STACK",

"id": "7895a45f-47aa-42ee-9d06-c66d3b784594",

"nodeType": "device", "x": 214, "y": 90, …

},

{

"deviceType": "WIRED",

"label": "40.0.5.12",

"id": "8f41bef8-698c-4701-af14-471e910ed9ff",

"nodeType": "host", "x": 186, "y": 132, …

}

(アトリビュートは抜粋)

"links":{

"source": "51a75ce9-d5c9-4fe2-95a0-6fc01410e201",

"startPortID": "",

"target": "f8c3fc68-cd26-4576-bcec-51f9b578f71e",

"endPortID": "16e94527-33fd-4968-a0d7-0f7265b72904",

"linkStatus": "UP"

}, {

"id": "459d7b7b-01c3-449a-841d-489e0250b8da",

"source": "f8c3fc68-cd26-4576-bcec-51f9b578f71e",

"startPortID": "0e841ab3-6192-4514-9736-d3ef63ed67f5",

"target": "e5f93514-3ae5-4109-8b52-b9fa876e1eae",

"endPortID": "02b1a0a6-3772-4b71-b2da-6d7cd87a5ec2",

"linkStatus": "UP"

},

….... …………

(省略)……………………….

{

"source": "7895a45f-47aa-42ee-9d06-c66d3b784594",

"startPortID": "30bb14c1-8fb6-45c4-8f6d-5b845a7f448c",

"target": "8f41bef8-698c-4701-af14-471e910ed9ff",

"endPortID": "",

"linkStatus": "UP"

}

https://<apic-em>/api/v1/topology/physical-topology

Topology Service• Nodes

"deviceType": "SWITCH",

"label": "SDN-BRANCH-3750-STACK",

"id": "7895a45f-47aa-42ee-9d06-c66d3b784594", /network-device/{id}

"nodeType": "device", "x": 214, "y": 90, …

"deviceType": "WIRED",

"label": "40.0.5.12",

"id": "8f41bef8-698c-4701-af14-471e910ed9ff", /host/{id}

"nodeType": "host", "x": 186, "y": 132, …

"source": "7895a45f-47aa-42ee-9d06-c66d3b784594",

"startPortID": "30bb14c1-8fb6-45c4-8f6d-5b845a7f448c", /interface/{id}

"target": "8f41bef8-698c-4701-af14-471e910ed9ff",

"endPortID": "",

"linkStatus": "UP"

• Links

https://<apic-em>/api/v1/topology/physical-topology

Topology Service

https://<apic-em>/api/v1/topology/physical-topologyAPIC-EM GUI (Topology)

Flow Analysis API

https://<apic-em>/api/v1/flow-analysis POST

{

"sourceIP" : "10.10.30.2",

"destIP" : "10.10.20.7"

}

{

"response": {

"taskId": "028fd5f0-3060-4070-9bf0-24b7bf8f5261",

"url": "/api/v1/task/028fd5f0-3060-4070-9bf0-24b7bf8f5261"

},

"version": "0.0"

}

Task Service API

{

"response": {

"rootId": "028fd5f0-3060-4070-9bf0-24b7bf8f5261",

"serviceType": "Policy Analysis Service",

"progress": "5ebd759d-fa19-427e-b6cf-4a7d91f41616",

"startTime": 1420793759044,

"endTime": 1420793769561,

"id": "028fd5f0-3060-4070-9bf0-24b7bf8f5261"

},

"version": "0.0"

}

https://<apic-em>/api/v1/flow-analysis/5ebd759d-fa19-427e-b6cf-4a7d91f41616 GET

https://<apic-em>/api/v1/task/028fd5f0-3060-4070-9bf0-24b7bf8f5261 GET

https://<apic-em>/api/v1/flow-analysis POST

{

"response": {

"taskId": "...

https://<apic-em>/api/v1/task/{taskId} GET

{

"response": {

"progress": "...

{

"response": {

"lastUpdate": "Wed Nov 25 06:16:34 UTC 2015",

"networkElementsInfo": [

{

"ip": "65.1.1.83",

"type": "wireless",

"id": "cf05d21e-29bc-4b9d-8a32-12f7877a8355",

"linkInformationSource": "Switched"

},

{

"name": "AP7081.059f.19ca",

"ip": "55.1.1.3",

"role": "ACCESS",

"linkInformationSource": "Switched",

"type": "Unified AP",

"id": "0a15fd77-44ba-4858-b3b1-0df37c4328e0",

"tunnels": [

"CAPWAP Tunnel"

]

},

https://<apic-em>/api/v1/flow-analysis/{progress} GET

For More Information

Cisco APIC EM

http://www.cisco.com/go/apicem

Cisco APIC EM Product Training

Cisco DevNet APIC EM Site

https://developer.cisco.com/site/apic-em/

Cisco DevNet Community APIC EM

https://communities.cisco.com/community/developer/networking/cisco-one/apic-em

http://www.cisco.com/c/en/us/products/se/training/Training_1440595679185.html

https://learninglabs.cisco.com/labs/tags/APIC-EM

Cisco DevNet Learning Labs APIC EM

Prime Infrastructure API

• APIC-EM “ポリシーコントローラー”(What?)

ポリシーベースの考え方に基づく(no CLI)

上位APIの抽象度が高い(カスタマイズ性は低い)

ネットワーク装置のコンフィグはなるべく意識させない

アプリケーション開発者に比重を置いた製品開発

ネットワーク”PaaS” (Platform-as-a-Service)

リアルタイムの変更システム

アプリケーションとプラットフォームを分離

• Prime Infrastructure “機能制御コントローラー”(What? and How?)

ネットワーク運用技術者向けツール(CLI)

上位APIはあるが、抽象度は低い

ネットワーク設定(コンフィグ)ありきの考え方

インフラ技術者には親しみやすい

カスタマイズ性が高い

履歴を含む記録システム

アプリケーションとプラットフォームが同一

APIC-EMとPrime Infrastructureの位置付け

APIC-EM・PIともに上位REST-APIをサポートし、プログラマビリティと自動化を支援

Prime

Infrastructure

REST API

Easy to Use

• REST (JSON, XML)

• ドキュメント

Managed

• API モニタリング• Rate Limiting

Secure

• HTTPS

• 認証

Extensible

• モジュール

Cisco Prime Infrastructure REST API

35

Major Areas in the API

• Inventory (Devices & Clients)

デバイスやクライアント情報の取得

• Reports

レポートの作成、CSVファイルで出力

• Configuration Templates

コンフィグの適用

http://www.cisco.com/web/JP/internet-of-everything-ioe/sdn/sp_hitachi.html

36

API Documentationhttps://<pi>/webacs/api/v1/

37

38

39

40

41

42

VTL (Velocity Template Language): http://velocity.apache.org/

cliTemplateConfiguration/deployTemplateThroughJob PUT

{

"cliTemplateCommand" : {

"targetDevices" : {

"targetDevice" : {

"targetDeviceID" : "String value",

"variableValues" : {

"variableValue" : {

"name" : "String value",

”name" : "String value"

}

}

}

},

"templateName" : "String value"

}

}

CLI Templates

Filtering, Sorting and Paging

• Filtering

/webacs/api/v1/data/Devices?ipAddress=”10.14.200.4”

• Sorting(昇順 or 降順)

/webacs/api/v1/data/Devices?.sort=+deviceName

• Paging

/webacs/api/v1/data/Devices?.full=true&.maxResults=4&.firstResult=5

44

For More Information

Cisco Prime Infrastructure

http://www.cisco.com/go/primeinfrastructure

Cisco Prime Infrastructure Product Training

Cisco DevNet Prime Infrastructure Site

https://developer.cisco.com/site/prime-infrastructure/

Cisco DevNet Community Prime Infrastructure

https://communities.cisco.com/community/developer/networking/cloud-and-systems-management/prime-infrastructure

http://http://www.cisco.com/c/m/en_us/training-events/product-training/prime-training-infrastructure.html

https://learninglabs.cisco.com/labs/tags/Prime%20Infrastructure

Cisco DevNet Learning Labs Prime Infrastructure

Connected Mobile ExperiencesAPI

Connected Mobile Experiences

(CMX)

Prime Infrastructure

(PI)

CMXMobility Services API

ワイヤレスネットワーク

Wireless LAN Controller (WLC)

コンポーネント

AP: Wi-FiクライアントからのRSSIを集めWLCへ通知WLC: APから受け取ったRSSIをまとめMSEへ送信CMX: WLCから受信したRSSIから位置情報(x, y)を算出PI: CMXを含むネットワーク全体を管理アプリケーションサーバ: REST APIでMSEから位置情報(x,

y)などを取得し、アプリケーションでMSEの情報を利用例)ユーザーの位置情報にもとづいたサービスを提供

アクセスポイント (AP)

アプリケーションサーバ2

アプリケーションサーバ1

Wi-Fi クライアント

47

REST API

RSSI (Received Signal Strength Indicator)

CMX API

• REST

• JSON

Major Areas in the APIMaps resources (Configuration)Active Clients (Location)

Clients History (Location) Notification subscription (Configuration)

APIの利用実例

• 参照したいフロアにいるクライアントをマップ上にプロット

Map + Active Clients

• プレゼンスやディレクトリアプリと連携し、該当するユーザーの現在地(ゾーン)を表示

Active Clients

• ショッピングアプリと連携し、あるゾーンへ入ってきたユーザーへクーポンをプッシュ

Notification

• 動線分析

Map + Clients history

Major Areas in Map resources API

• /api/config/v1/maps

• マップ全体 (campuses, building, floors)の情報(サイズ、ゾーンなど)

• /api/config/v1/maps/info/{campusName}/{buildingName}/{floorName}

• 該当するフロア情報 (campusName > buildingName > floorName)

• /api/config/v1/maps/image/{campusName}/{buildingName}/{floorName}

• 該当するフロアイメージ (campusName > buildingName > floorName)

• /api/config/v1/maps/imagesource/{imageName}

• imageNameで指定したイメージ

Map Image

Map Info

Major Areas in Active clients API

• /api/location/v2/clients

すべてのクライアントリスト

• /api/location/v2/clients{?[ipaddress|macAddress|username]}

IDで指定したクライアント (MAC address, IP address, username)

• MAC: /api/location/v2/clients?macAddress=30:f7:c5:cc:3e:xx

• IP: /api/location/v2/clients?ipAddress=10.10.10.10

• Username: /api/location/v2/clients?username=someUsername

• /api/location/v2/clients/count

クライアント数

Clients API

REST API Documentation

• https://<CMX>/apidocs/

REST API Documentation - Try

https://developer.cisco.com/site/cmx-mobility-services/

DevNetCMX Mobility Services API

https://developer.cisco.com/site/devnet/sandbox/networking/

DevNetNetworking Sandbox

https://developer.cisco.com/site/devnet/learningLabs/overview.gsp

DevNetLearning Lab

http://gblogs.cisco.com/jp/author/atsushiyamazaki/

Cisco Japan Blog