Networks and Bridges APIs

Bridge APIs

By default, a LAN bridge (lan-br), a WAN bridge (wan-br) and wan2-br for ENCS 5000 series are created in the system.

Table 1. Bridge APIs

Action

Method

Payload Required

API

To create a bridge

POST

Yes

/api/config/bridges

To verify a bridge configuration

GET

No

/api/config/bridges?deep

To get specific IP/DHCP info for all bridges

GET

No

/api/operational/bridge-settings/<ip/dhcp_configuration>

To get specific IP/DHCP info for specific bridge

GET

No

/api/operational/bridge-settings/<br_name>/<ip/dhcp_configuration>

To modify a bridge, and attach a port to the bridge

PUT

Yes

/api/config/bridges/bridge/<bridge name>

To delete a bridge

DELETE

No

/api/config/bridges/bridge/<bridge name>

Example for Bridge Payload


<bridge>
	<name>sc-br</name>
	<port>
		<name>eth3</name>
	</port>
</bridge>
Table 2. Bridge Payload Description

Property

Type

Description

Mandatory/Default Value

bridge name

String

Name of the bridge. Yes
port name

String

Name of the port the bridge is attached to. Yes

dhcp

Flag to specify DHCP configuration

No

ip address

String

IP address

No

ip netmask

String

Netmask

No

dhcp-ipv6

Flag to specify DHCP IPv6 configuration

No

slaac-ipv6

Flag to specify SLAAC IPv6 configuration

No

ipv6 address

String

IPv6 address and prefix length

No

vlan

Integer

VLAN tag

No

Example: POST Bridge Creation API


curl -k -v -u admin:admin -H Content-Type:application/vnd.yang.data+xml -X 
POST https://209.165.201.1/api/config/bridges -d "<bridge><name>sc-br</name><port><name>eth3</name></port><dhcp/><dhcp-ipv6/></bridge>”. "
* About to connect() to 209.165.201.1 port 443 (#0)
*   Trying 209.165.201.1... connected
* Connected to 209.165.201.1 (209.165.201.1) port 443 (#0)
* Initializing NSS with certpath: sql:/etc/pki/nssdb
* warning: ignoring value of ssl.verifyhost
* skipping SSL peer certificate verification
* SSL connection using TLS_DHE_RSA_WITH_AES_128_CBC_SHA
* Server certificate:
* 	subject: CN=Cisco-Enterprise-NFVIS-Self-Signed-Certificate
* 	start date: Mar 21 20:02:15 2016 GMT
* 	expire date: Mar 19 20:02:15 2026 GMT
* 	common name: Cisco-Enterprise-NFVIS-Self-Signed-Certificate
* 	issuer: CN=Cisco-Enterprise-NFVIS-Self-Signed-Certificate
* Server auth using Basic with user 'admin'
> POST /api/config/bridges HTTP/1.1
> Authorization: Basic YWRtaW46YWRtaW4=
> User-Agent: curl/7.19.7 (x86_64-redhat-linux-gnu) libcurl/7.19.7 NSS/3.16.2.3 Basic ECC zlib/1.2.3 libidn/1.18 libssh2/1.4.2
> Host: 209.165.201.1
> Accept: */*
> Content-Type:application/vnd.yang.data+xml
> Content-Length: 66
> 
< HTTP/1.1 201 Created
< Server: nginx/1.6.3
< Date: Sat, 02 Apr 2016 00:21:25 GMT
< Content-Type: text/html
< Content-Length: 0
< Location: https://209.165.201.1/api/config/bridges/bridge/sc-br
< Connection: keep-alive
< Last-Modified: Sat, 02 Apr 2016 00:21:24 GMT
< Cache-Control: private, no-cache, must-revalidate, proxy-revalidate
< Etag: 1459-556484-952070
< Pragma: no-cache
< 
* Connection #0 to host 209.165.201.1 left intact



Example: GET Bridge Configuration API


curl -k -v -u admin:admin -H Content-Type:application/vnd.yang.data+xml -X
GET "https://209.165.201.1/api/config/bridges?deep"
* About to connect() to 209.165.201.1 port 443 (#0)
*   Trying 209.165.201.1... connected
* Connected to 209.165.201.1 (209.165.201.1) port 443 (#0)
* Initializing NSS with certpath: sql:/etc/pki/nssdb
* warning: ignoring value of ssl.verifyhost
* skipping SSL peer certificate verification
* SSL connection using TLS_DHE_RSA_WITH_AES_128_CBC_SHA
* Server certificate:
* 	subject: CN=Cisco-Enterprise-NFVIS-Self-Signed-Certificate
* 	start date: Mar 21 20:02:15 2016 GMT
* 	expire date: Mar 19 20:02:15 2026 GMT
* 	common name: Cisco-Enterprise-NFVIS-Self-Signed-Certificate
* 	issuer: CN=Cisco-Enterprise-NFVIS-Self-Signed-Certificate
* Server auth using Basic with user 'admin'
> GET /api/config/bridges?deep HTTP/1.1
> Authorization: Basic YWRtaW46YWRtaW4=
> User-Agent: curl/7.19.7 (x86_64-redhat-linux-gnu) libcurl/7.19.7 NSS/3.16.2.3 Basic ECC zlib/1.2.3 libidn/1.18 libssh2/1.4.2
> Host: 209.165.201.1
> Accept: */*
> 
< HTTP/1.1 200 OK
< Server: nginx/1.6.3
< Date: Sat, 02 Apr 2016 00:18:44 GMT
< Content-Type: application/vnd.yang.data+xml
< Transfer-Encoding: chunked
< Connection: keep-alive
< Last-Modified: Sat, 02 Apr 2016 00:16:51 GMT
< Cache-Control: private, no-cache, must-revalidate, proxy-revalidate
< Etag: 1459-556211-275675
< Pragma: no-cache
< 

<bridges xmlns="http://www.cisco.com/nfv/network" xmlns:y="http://tail-f.com/ns/rest" xmlns:network="http://www.cisco.com/nfv/network">
  <bridge>
    <name>lan-br</name>
    <port>
      <name>eth0</name>
    </port>
  </bridge>
  <bridge>
    <name>wan-br</name>
    <port>
      <name>eth1</name>
    </port>
    <ip>
      <address>209.165.201.1</address>
      <netmask>255.255.255.0</netmask>
    </ip>
    <ipv6>
      <address>2001:DB8:1:1::72/64</address>
    </ipv6>
  </bridge>
  <bridge>
    <name>sc-br</name>
    <port>
      <name>eth3</name>
    </port>
  </bridge>
</bridges>

* Connection #0 to host 209.165.201.1 left intact



Example: GET IPv4 address for all bridges


curl -k -v -u admin:admin -H "Accept:application/vnd.yang.data+json" -H "Content-Type:application/vnd.yang.data+json" -X GET 
https://localhost/api/operational/bridge-settings/ip-info/ipv4_address

Example: GET dhcp enabled under wan-br


curl -k -v -u admin:admin -H "Accept:application/vnd.yang.data+json" -H "Content-Type:application/vnd.yang.data+json" -X GET 
https://localhost/api/operational/bridge-settings/wan-br/dhcp/enabled

Example: DELETE Bridge API


curl -k -v -u admin:admin -X 
DELETE https://209.165.201.1/api/config/bridges/bridge/sc-br
* About to connect() to 209.165.201.1 port 443 (#0)
*   Trying 209.165.201.1... connected
* Connected to 209.165.201.1 (209.165.201.1) port 443 (#0)
* Initializing NSS with certpath: sql:/etc/pki/nssdb
* warning: ignoring value of ssl.verifyhost
* skipping SSL peer certificate verification
* SSL connection using TLS_DHE_RSA_WITH_AES_128_CBC_SHA
* Server certificate:
* 	subject: CN=Cisco-Enterprise-NFVIS-Self-Signed-Certificate
* 	start date: Mar 21 20:02:15 2016 GMT
* 	expire date: Mar 19 20:02:15 2026 GMT
* 	common name: Cisco-Enterprise-NFVIS-Self-Signed-Certificate
* 	issuer: CN=Cisco-Enterprise-NFVIS-Self-Signed-Certificate
* Server auth using Basic with user 'admin'
> DELETE /api/config/bridges/bridge/sc-br HTTP/1.1
> Authorization: Basic YWRtaW46YWRtaW4=
> User-Agent: curl/7.19.7 (x86_64-redhat-linux-gnu) libcurl/7.19.7 NSS/3.16.2.3 Basic ECC zlib/1.2.3 libidn/1.18 libssh2/1.4.2
> Host: 209.165.201.1
> Accept: */*
> 
< HTTP/1.1 204 No Content
< Server: nginx/1.6.3
< Date: Sat, 02 Apr 2016 00:19:30 GMT
< Content-Type: text/html
< Content-Length: 0
< Connection: keep-alive
< Last-Modified: Sat, 02 Apr 2016 00:19:30 GMT
< Cache-Control: private, no-cache, must-revalidate, proxy-revalidate
< Etag: 1459-556370-37827
< Pragma: no-cache
< 
* Connection #0 to host 209.165.201.1 left intact


Network Creation APIs

By default a LAN network (lan-net), a WAN network (wan-net) and wan2-net for ENCS 5000 series are created in the system.

Table 3. Network Creation APIs

Action

Method

Payload Required

API

To create a network

POST

Yes

/api/config/networks

To verify network configuration details

GET

No

/api/config/networks?deep

To modify a network

PUT

Yes

/api/config/networks/network/<network name>

To delete a network

DELETE

No

/api/config/networks/network/<network name>

Example for Network Creation Payload


<network>
	<name>sc-net</name>
	<bridge>sc-bridge</bridge>
</network>
Table 4. Network Creation Payload Description

Property

Type

Description

Mandatory/Default Value

network name

String Name of the network. Yes

bridge

String Name of the bridge the network is attached to. Yes

trunk

Boolean

Network set to trunk mode.

No/true

sriov

Boolean

SR-IOV supported on the network.

No/false

native-tagged

Boolean

Specifies if the netowrk is tagged or not.

No

native-vlan

Integer

Specifies a native VLAN. It sets the native characteristics when the interface is in trunk mode. If you do not configure a native VLAN, the default VLAN 1 is used as the native VLAN.

No

vlan

Integer

Specifies the VLAN number. If the trunk parameter is configured as true, this parameter specifies a set of VLAN numbers and ranges

If trunk parameter is false, access mode is true, then this parameter can have only one VLAN number.

No

Example: POST Network API



curl -k -v -u admin:admin -H Content-Type:application/vnd.yang.data+xml -X 
POST  https://209.165.201.1/api/config/networks -d "<network><name>sc-net</name><bridge>sc-bridge</bridge></network>"

* About to connect() to 209.165.201.1 port 443 (#0)
*   Trying 209.165.201.1... connected
* Connected to 209.165.201.1 (209.165.201.1) port 443 (#0)
* Initializing NSS with certpath: sql:/etc/pki/nssdb
* warning: ignoring value of ssl.verifyhost
* skipping SSL peer certificate verification
* SSL connection using TLS_DHE_RSA_WITH_AES_128_CBC_SHA
* Server certificate:
* 	subject: CN=Cisco-Enterprise-NFVIS-Self-Signed-Certificate
* 	start date: Mar 21 20:02:15 2016 GMT
* 	expire date: Mar 19 20:02:15 2026 GMT
* 	common name: Cisco-Enterprise-NFVIS-Self-Signed-Certificate
* 	issuer: CN=Cisco-Enterprise-NFVIS-Self-Signed-Certificate
* Server auth using Basic with user 'admin'
> POST /api/config/networks HTTP/1.1
> Authorization: Basic YWRtaW46YWRtaW4=
> User-Agent: curl/7.19.7 (x86_64-redhat-linux-gnu) libcurl/7.19.7 NSS/3.16.2.3 Basic ECC zlib/1.2.3 libidn/1.18 libssh2/1.4.2
> Host: 209.165.201.1
> Accept: */*
> Content-Type:application/vnd.yang.data+xml
> Content-Length: 62
> 
< HTTP/1.1 201 Created
< Server: nginx/1.6.3
< Date: Sat, 02 Apr 2016 00:14:37 GMT
< Content-Type: text/html
< Content-Length: 0
< Location: https://209.165.201.1/api/config/networks/network/sc-net
< Connection: keep-alive
< Last-Modified: Sat, 02 Apr 2016 00:14:37 GMT
< Cache-Control: private, no-cache, must-revalidate, proxy-revalidate
< Etag: 1459-556077-695828
< Pragma: no-cache
< 
* Connection #0 to host 209.165.201.1 left intact