Upload
others
View
15
Download
0
Embed Size (px)
Citation preview
PFC-WebAPI
July 2015
NEC Corporation of America
Page 2
Introduction
▌This document is to walk you through to understand how you can
control PFC via its Rest API as known as PFC WebAPI.
▌REST API becomes a well-known term these days for those
software developers or Web programmers. There are many tools to
verify the API programming behavior such as curl, Advanced REST
Client and etc. This document will use the Advanced REST Client
to demonstrate PFC WebAPI feature. The examples are using
JSON format but can be XML format.
▌Please refer to the webapi user reference guide to install and
enable the WebAPI function on PFC and for the full supported
operations through WebAPI.
Contents
PFC-WebAPI overview
List of available WebAPI operations
Mininet WebAPIDemo
• Steps to create L2 virtual network.
• Verify VTN-stations, dataflow in real-network and virtual network.
Page 3
▌What is WebAPI ?
As figures shown, user send the HTTPS request to WebAPI in PFC. PFC
retrieves that information which was readibly available to operate. such as
creating VTN, removing VTN and pulling some information.
With Linux host, Curl command enables to PFC remotely.
Page 4
WebAPI Overview
PFC HTTPS Request
xml/json format
User/
Operator
HTTPs response
vtn VTN1 {
vbridge VB1 {
vlan-map vlan-id 11
interface if1
interface if2
}
}
WebAPI
Page 5
PFC WebAPI Overview
▌JSON and XML format
▌WebAPI already installed. Requires to a few configuration to activate.
▌The corresponded version matrix*.
▌Simple verification whether WebAPI is up or down.
https:// <IP address of WebAPI>:8080/pfc_webapi_version.json or .xml
PFC version WebAPI
V3.0 V1.0
V4.0 V1.1
V5.0 V1.2
V5.1 V1.3
V6.0 V1.4
V6.1 V1.5
V6.2 V1.6
List of available operations
Operation Category Operation
Base Startup-configuration
PFC process alarm
API version
Physical network flow
Physical network topology
OFS
VTN station information
Trunk port
L2 VTN
VTN Flow
OFS map information (VTN mode)
vBridge
vBridge IP address
Interface (vBridge mode)
MAC entry
VLAN map
OFS map information (vExternal mode)
vLink
L2 domain configuration information
L2/L3 VTN topology
vExternal
Interface (vExternal mode)
L3 vRouter
DHCP relay
Interface(vRouter mode)
IP Routing information
Page 6
Operation Category Operation
QoS Policing profile
Policing profile entry
Policing setting information for flooding packets
Policing setting information (vtn mode)
Policing setting information (vbridge mode)
Policing setting information (vexternal mode)
OFS QoS flow entry information
Policy management Flowlist
Flowlist entry
Flow filter (vBridge interface)
Flow filter entry (vBridge interface)
Flow filter (vExternal interface)
Flow filter entry (vExternal interface)
Flow filter (vRouter interface)
Flow filter entry (vRouter interface)
Network monitor group
Monitoring host
Global path map
Path policy
Linkweight
VTN path map
IP routing information using the net monitoring function
Flow filter (VTN)
Flow filter entry (VTN)
Flow filter (vBridge)
Flow filter entry (vBridge)
Safe flow filter (vExternal)
Safe flow filter entry (vExternal)
Discovery Mininet Topology
Page 7
PFC 6800
Physical topology
pfc6vb
L2 virtual network Config flow
Page 8
Configuration steps to allows 2 VMs to communicate.
Create a VTN
Create a vBridge in the VTN.
Map the vlan id in vBridge.
Create the virtual interface in vBridge.
Create the vExternal.
Create the virtual interface in vExternal.
Set the OF-map; corresponding the physical port with vExternal.
Create the virtual link between interfaces of vBridge and vExternal.
vBridge
VTN_CustomerA
vExternal vExternal
j k
l
m
n
q
n
S2 S3
m
Logical Network
Real-Network
o
p p
o
tagged
vlan100
tagged
vlan100
WebAPI – REST Client / JSON
▌ j Create the VTN “VTN1”
Page 9
URI https://pfc6vb:8080/vtns.json
Method POST
Body {
"vtn" : {
"vtn_name" : "VTN1"
}
}
Response 200OK. In case of failure, 400 or 500.
PFC# show running-config
system
cli
network-default {
openflow-version 1.3
}
real-network {
ofs-default-domain
}
vtn VTN1 ; Added
PFC#
RESTFul API PFC CLI
WebAPI – REST Client / JSON
▌ k Create the vBridge “VB1” in VTN1.
Page 10
URI https://pfc6vb:8080/vtns/VTN1/vbridges.json
Method POST
Body {
"vbridge" : {
"vbr_name" : "vb1"
}
}
Response 200OK. In case of failure, 400 or 500.
PFC# show running-config
system
cli
network-default {
openflow-version 1.3
}
real-network {
ofs-default-domain
}
vtn VTN1 {
vbridge vb1 ; Added
}
PFC#
REST API PFC CLI
WebAPI – REST Client / JSON
▌ l Map the vlan ID “100” to vBridge “VB1” in VTN1.
Page 11
URI https://pfc6vb:8080/vtns/VTN1/vbridges/vb1/vlanmaps.j
son
Method POST
Body * {
"vlanmap" : {
"vlan_id" : "100"
}
}
Response 200OK. In case of failure, 400 or 500.
PFC# show running-configuration
system
cli
network-default
real-network {
ofs-default-domain
}
vtn VTN1 {
vbridge vb1 {
vlan-map vlan-id 100 ; Added.
}
}
PFC# * DPID, OFS_Subdomain_Name can be included.
REST API PFC CLI
WebAPI – REST Client / JSON
▌ m Create the virtual interface “if1” and “if2” in “vb1” vbridge.
Page 12
URI https://pfc6vb:8080/vtns/VTN1/vbridges/vb1/interfaces.j
son
Method POST
Body {
"interface" : {
"if_name" : "vb1if1"
}
}
Response 200OK. In case of failure, 400 or 500.
PFC# sho running-config
system
cli
network-default
real-network {
ofs-default-domain
}
vtn VTN1 {
vbridge vb1 {
vlan-map vlan-id 100
interface vb1if1 ; Added
interface vb1if2 ; Added
}
}
PFC#
URI https://pfc6vb:8080/vtns/VTN1/vbridges/vb1/interfaces.j
son
Method POST
Body {
"interface" : {
"if_name" : "vb1if2"
}
}
Response 200OK. In case of failure, 400 or 500.
REST API PFC CLI
WebAPI – REST Client / JSON
▌ n Create the vExternal.
Page 13
URI https://pfc6vb:8080/vtns/VTN1/vexternals.json
Method POST
Body {
"vexternal" : {
"vex_name" : "vexs2"
}
}
Response 200OK. In case of failure, 400 or 500.
PFC# show running-configuration
system
cli
network-default
real-network {
ofs-default-domain
}
vtn VTN1 {
vbridge vb1 {
vlan-map vlan-id 100
interface vb1if1
interface vb1if2
}
vexternal vexs2 ; Added
vexternal vexs3 ; Added
}
PFC#
URI https://pfc6vb:8080/vtns/VTN1/vexternals.json
Method POST
Body {
"vexternal" : {
"vex_name" : "vexs3"
}
}
Response 200OK. In case of failure, 400 or 500.
REST API PFC CLI
WebAPI – REST Client / JSON
▌ o Create the virtual interface in vExternal.
Page 14
URI https://pfc6vb:8080/vtns/VTN1/vexternals/vexs2/interfa
ces.json
Method POST
Body {
"interface" : {
"if_name" : "vexs2if"
}
}
Response 200OK. In case of failure, 400 or 500.
PFC# show running-configuration
system
cli
network-default
real-network {
ofs-default-domain
}
vtn VTN1 {
vbridge vb1 {
vlan-map vlan-id 100
interface vb1if1
interface vb1if2
}
vexternal vexs2 {
interface vexs2if ; Added
}
vexternal vexs3 {
interface vexs3if ; Added
}
}
PFC#
URI https://pfc6vb:8080/vtns/VTN1/vexternals/vexs3/interfa
ces.json
Method POST
Body {
"interface" : {
"if_name" : "vexs3if"
}
}
Response 200OK. In case of failure, 400 or 500.
REST API PFC CLI
PFC# show running-configuration
system
cli
network-default
real-network {
ofs-default-domain
}
vtn VTN1 {
vbridge vb1 {
vlan-map vlan-id 100
interface vb1if1
interface vb1if2
}
vexternal vexs2 {
ofs-map ofs-datapath-id 0000-0000-0000-0002 ofs-port s2-eth1
vlan-id 100 tagged
interface vexs2if
}
vexternal vexs3 {
ofs-map ofs-datapath-id 0000-0000-0000-0003 ofs-port s3-eth1
vlan-id 100 tagged
interface vexs3if
}
} PFC#
URI https://pfc6vb:8080/vtns/VTN1/vexternals/vexs
2/ofsmap.json
Method PUT
Body {
"ofsmap" : {
"dp_id" : "0000-0000-0000-0002",
"port_name" : "s2-eth1",
"vlan_id" : "100",
"tagged" : "true"
}
}
Rsp 200OK. In case of failure, 400 or 500.
WebAPI – REST Client / JSON
▌ p Set the OF-map, corresponding the physical port with vExternal.
Page 15
URI https://pfc6vb:8080/vtns/VTN1/vexternals/vexs
3/ofsmap.json
Method PUT
Body {
"ofsmap" : {
"dp_id" : "0000-0000-0000-0003",
"port_name" : "s3-eth1",
"vlan_id" : "100",
"tagged" : "true"
}
}
Rsp 200OK. In case of failure, 400 or 500.
REST API PFC CLI
WebAPI – REST Client / JSON
▌ q Create the virtual link to connect virtual interfaces of vExternal
and vBridge.
Page 16
URI https://pfc6vb:8080/vtns/VTN1/vlinks.json
Method POST
Body {
"vlink" : {
"vlk_name" : "vlink_vb1_vexs2",
"vbr_name" : "vb1",
"if_name" : "vb1if1",
"vtnnode_name" : "vexs2",
"vtnnode_if_name" : "vexs2if"
}
}
Respon
se
200OK. In case of failure, 400 or 500.
URI https://pfc6vb:8080/vtns/VTN1/vlinks.json
Method POST
Body {
"vlink" : {
"vlk_name" : "vlink_vb1_vexs3",
"vbr_name" : "vb1",
"if_name" : "vb1if2",
"vtnnode_name" : "vexs3",
"vtnnode_if_name" : "vexs3if"
}
}
Respon
se
200OK. In case of failure, 400 or 500.
REST API
WebAPI – REST Client / JSON
▌ q (cont’d.) Create the virtual link to connect virtual interfaces of
vExternal and vBridge.
Page 17
PFC# show running-configuration
--- Omit ----
}
vtn VTN1 {
vbridge vb1 {
vlan-map vlan-id 100
interface vb1if1
interface vb1if2
}
vexternal vexs2 {
ofs-map ofs-datapath-id 0000-0000-0000-0002 ofs-port s2-eth1 vlan-id 100 tagged
interface vexs2if
}
vexternal vexs3 {
ofs-map ofs-datapath-id 0000-0000-0000-0003 ofs-port s3-eth1 vlan-id 100 tagged
interface vexs3if
}
vlink vlink_vb1_vexs2 {
vtn link vbridge vb1 interface vb1if1 vtnnode vexs2 interface vexs2if
}
vlink vlink_vb1_vexs3 {
vtn link vbridge vb1 interface vb1if2 vtnnode vexs3 interface vexs3if
}
}
PFC#
In case of PFC CLI
Visualization: Flows between 2 hosts.
Page 18
VTN map: Logical topology and flow
Physical Map: physical topology discovery
Response },
"statistics": {
"packets": "565",
"octets": "54478",
"duration": "547"
},
"pathinformations": [
{
"hop": "1",
"inport": "s3-eth1",
"ofs": "0000-0000-0000-0003",
"outport": "s3-eth2"
},
{
"hop": "2",
"inport": "s2-eth3",
"ofs": "0000-0000-0000-0002",
"outport": "s2-eth1"
}
]
}
],
"totalcount": {
"value": "2"
}
}---- end -----
WebAPI – Verify real-network data flows details/ JSON
Page 19
REST API
URI https://pfc6vb:8080/realnetwork/dataflows/detail.j
son
Method GET
Body none
Response {
"dataflows": [
{
"flowid": "68250",
"status": "active",
"flowtype": "dynamic",
"pathpolicyindex": "0",
"vtnid": "16777225",
"ingressofsdpid": "0000-0000-0000-0002",
"inport": "s2-eth1",
"instationid": "8",
"egressofsdpid": "0000-0000-0000-0003",
"outport": "s3-eth1",
"outstationid": "9",
"flowentryinformation": {
"match": {
"dstmac": "6ed5.801a.f55a",
"inport": "1",
"srcmac": "725f.91d8.383a",
"vlan_id": "100"
},
"action": {
"outport": "1"
----- Omit *------ * full response body can be seen in memo.
PFC CLI - Verify real-network data flows details
Verify that real-network data-flow details by PFC CLI
Page 20
[real-network]
PFC# show data-flow detail
Date: 2014-09-25 19:57:50 EDT
FlowID:68250 Status:active FlowType:dynamic
PathPolicyIndex:0 VTNId:16777225
IngressOFS:0000-0000-0000-0002 InPort :s2-eth1 StationId:8
OFS domain:Default_OFS_Domain OFS subdomain:
Egress OFS:0000-0000-0000-0003 OutPort:s3-eth1 StationId:9
OFS domain:Default_OFS_Domain OFS subdomain:
FlowEntryInformation:
Match:
In Port :1
Src MAC :725f.91d8.383a
Dst MAC :6ed5.801a.f55a
VLAN ID :100
Action:
Output Port :1
Statistics:
Packets : 614
Octets : 59344
Duration: 598 sec
PathInformation:
Hop InPort OFS OutPort
1 s2-eth1 0000-0000-0000-0002 s2-eth3
2 s3-eth2 0000-0000-0000-0003 s3-eth1
FlowID:68253 Status:active FlowType:dynamic
PathPolicyIndex:0 VTNId:16777225
IngressOFS:0000-0000-0000-0003 InPort :s3-eth1
StationId:9
OFS domain:Default_OFS_Domain OFS subdomain:
Egress OFS:0000-0000-0000-0002 OutPort:s2-eth1
StationId:8
OFS domain:Default_OFS_Domain OFS subdomain:
FlowEntryInformation:
Match:
In Port :1
Src MAC :6ed5.801a.f55a
Dst MAC :725f.91d8.383a
VLAN ID :100
Action:
Output Port :1
Statistics:
Packets : 619
Octets : 59666
Duration: 598 sec
PathInformation:
Hop InPort OFS OutPort
1 s3-eth1 0000-0000-0000-0003 s3-eth2
2 s2-eth3 0000-0000-0000-0002 s2-eth1
Total count:2
[real-network]
PFC#
Response "flowid": "68253",
"createdtime": "2014-09-25 19:47:51",
"egressportname": "s2-eth1",
"egressvnode": "vexs2",
"hardtimeout": "0",
"idletimeout": "300",
"ingressportname": "s3-eth1",
"ingressvnode": "vexs3",
"ingressofsdpid": "0000-0000-0000-0003",
"egressofsdpid": "0000-0000-0000-0002",
"match": {
"dstmac": "725f.91d8.383a",
"inport": "1",
"srcmac": "6ed5.801a.f55a",
"vlan_id": "100"
},
"action": {
"outport": "1"
},
"statistics": {
"packets": "709",
"octets": "68330",
"duration": "686"
}
}
]
}---- end -----
WebAPI – Verify VTN data flows details / JSON
Page 21
REST API
URI https://pfc6vb:8080/vtns/VTN1/dataflows/detail.json
Method GET
Body none
Response {
"dataflows": [
{
"flowid": "68250",
"createdtime": "2014-09-25 19:47:51",
"egressportname": "s3-eth1",
"egressvnode": "vexs3",
"hardtimeout": "0",
"idletimeout": "300",
"ingressportname": "s2-eth1",
"ingressvnode": "vexs2",
"ingressofsdpid": "0000-0000-0000-0002",
"egressofsdpid": "0000-0000-0000-0003",
"match": {
"dstmac": "6ed5.801a.f55a",
"inport": "1",
"srcmac": "725f.91d8.383a",
"vlan_id": "100"
},
"action": {
"outport": "1"
----- Omit *------
* full response body can be seen in memo.
PFC CLI – Verify VTN data flows details
Verify that VTN data-flows details by PFC CLI
Page 22
[vtn VTN1]
PFC# show data-flow detail
Date: 2014-09-25 19:59:42 EDT
data-flow:68250 Created time:2014-09-25 19:47:51
Ingress VTN node:vexs2
Egress VTN node:vexs3
Ingress OFS DPID:0000-0000-0000-0002 PortName:s2-eth1
OFS Domain:Default_OFS_Domain OFS subdomain:
Egress OFS DPID:0000-0000-0000-0003 PortName:s3-eth1
OFS Domain:Default_OFS_Domain OFS subdomain:
Idle timeout:300 sec Hard timeout:0 sec
Match:
In Port:1
VLAN ID:100
Src MAC:725f.91d8.383a
Dst MAC:6ed5.801a.f55a
Action:
Output Port:1
Statistics:
Packets : 729
Octets : 70406
Duration:710 sec
data-flow:68253 Created time:2014-09-25 19:47:51
Ingress VTN node:vexs3
Egress VTN node:vexs2
Ingress OFS DPID:0000-0000-0000-0003 PortName:s3-eth1
OFS Domain:Default_OFS_Domain OFS subdomain:
Egress OFS DPID:0000-0000-0000-0002 PortName:s2-eth1
OFS Domain:Default_OFS_Domain OFS subdomain:
Idle timeout:300 sec Hard timeout:0 sec
Match:
In Port:1
VLAN ID:100
Src MAC:6ed5.801a.f55a
Dst MAC:725f.91d8.383a
Action:
Output Port:1
Statistics:
Packets : 734
Octets : 70728
Duration:710 sec
[vtn VTN1]
PFC#
WebAPI –Verify VTN stations / JSON
Page 23
REST API
URI https://pfc6vb:8080/vtnstations.json
Method GET
Body none
Response {
"vtnstations": [
{
"stationid": "8",
"createdtime": "2014-09-25 19:45:02",
"macaddr": "725f.91d8.383a",
"ipaddr": [
"192.168.100.2"
],
"maptype": "ofs-map",
"mapstatus": "valid",
"vtn_name": "VTN1",
"vex_name": "vexs2",
"vexternalstatus": "up",
"dp_id": "0000-0000-0000-0002",
"port_name": "s2-eth1",
"vlan_id": "100"
},
Response {
"stationid": "9",
"createdtime": "2014-09-25
19:46:31",
"macaddr": "6ed5.801a.f55a",
"ipaddr": [
"192.168.100.3"
],
"maptype": "ofs-map",
"mapstatus": "valid",
"vtn_name": "VTN1",
"vex_name": "vexs3",
"vexternalstatus": "up",
"dp_id": "0000-0000-0000-0003",
"port_name": "s3-eth1",
"vlan_id": "100"
}
]
}
PFC CLI – Verify VTN stations
Page 24
PFC# show vtn-station
Date: 2014-09-25 20:01:27 EDT
VTN station ID:8 Created time:2014-09-25 19:45:02
MAC address :725f.91d8.383a
IP address :192.168.100.2
OFS DPID :0000-0000-0000-0002 PortName:s2-eth1 VLAN ID:100
OFS Domain :Default_OFS_Domain OFS subdomain:
MapType :ofs-map Status:valid
VTN :VTN1
vExternal :vexs2 Status:up
VTN station ID:9 Created time:2014-09-25 19:46:31
MAC address :6ed5.801a.f55a
IP address :192.168.100.3
OFS DPID :0000-0000-0000-0003 PortName:s3-eth1 VLAN ID:100
OFS Domain :Default_OFS_Domain OFS subdomain:
MapType :ofs-map Status:valid
VTN :VTN1
vExternal :vexs3 Status:up
PFC#
Verify that VTN stations by PFC CLI.
Reference
▌pfc_configuration_guide_en.pdf - for PFCshell command reference.
▌pfc_webapi_users_guide_en.pdf - for installation WebAPI
Page 25
NEC brings together and integrates technology and expertise to create
the ICT-enabled society of tomorrow.
We collaborate closely with partners and customers around the world,
orchestrating each project to ensure all its parts are fine-tuned to local needs.
Every day, our innovative solutions for society contribute to
greater safety, security, efficiency and equality, and enable people to live brighter lives.
Page 27 NEC group confidential