${body} OperatingSystem.Get File ${data_file}
${resp} RequestsLibrary.Put session ${dest_uri} data=${body} headers=${headers}
Should Be Equal As Strings ${resp.status_code} 200
+
+Post Elements To URI From File
+ [Arguments] ${dest_uri} ${data_file}
+ ${body} OperatingSystem.Get File ${data_file}
+ ${resp} RequestsLibrary.Post session ${dest_uri} data=${body} headers=${headers}
+ Should Be Equal As Strings ${resp.status_code} 200
--- /dev/null
+*** Settings ***
+Documentation Test suite for Group Based Policy, Operates functions from Restconf APIs.
+Suite Setup Create Session session http://${CONTROLLER}:${RESTCONFPORT} auth=${AUTH} headers=${HEADERS}
+Suite Teardown Delete All Sessions
+Library SSHLibrary
+Library Collections
+Library OperatingSystem
+Library RequestsLibrary
+Variables ../../../variables/Variables.py
+Resource ../../../libraries/Utils.txt
+
+*** Variables ***
+${REGISTER_ENDPOINT_FILE} ../../../variables/gbp/register-endpoint.json
+${UNREGISTER_ENDPOINT_FILE} ../../../variables/gbp/unregister-endpoint.json
+
+*** Test Cases ***
+Register and Unregister Endpoint
+ [Documentation] Register and Unregister Endpoint from JSON file
+ Post Elements To URI From File ${GBP_REGEP_API} ${REGISTER_ENDPOINT_FILE}
+ Post Elements To URI From File ${GBP_UNREGEP_API} ${UNREGISTER_ENDPOINT_FILE}
--- /dev/null
+*** Settings ***
+Documentation Test suite for GBP Tenants, Operates functions from Restconf APIs.
+Suite Setup Create Session session http://${CONTROLLER}:${RESTCONFPORT} auth=${AUTH} headers=${HEADERS}
+Suite Teardown Delete All Sessions
+Library SSHLibrary
+Library Collections
+Library OperatingSystem
+Library RequestsLibrary
+Variables ../../../variables/Variables.py
+Resource ../../../libraries/Utils.txt
+
+*** Variables ***
+${GBP_TENANTS_FILE} ../../../variables/gbp/tenants.json
+
+${GBP_TENENT_ID} f5c7d344-d1c7-4208-8531-2c2693657e12
+${GBP_TENANT1_API} /restconf/config/policy:tenants/policy:tenant/${GBP_TENENT_ID}
+${GBP_TENANT1_FILE} ../../../variables/gbp/tenant1.json
+
+
+*** Test Cases ***
+Add Tenants
+ [Documentation] Add Tenants from JSON file
+ Add Elements To URI From File ${GBP_TENANTS_API} ${GBP_TENANTS_FILE}
+ ${body} OperatingSystem.Get File ${GBP_TENANTS_FILE}
+ ${jsonbody} To Json ${body}
+ ${resp} RequestsLibrary.Get session ${GBP_TENANTS_API}
+ Should Be Equal As Strings ${resp.status_code} 200
+ ${result} To JSON ${resp.content}
+ Lists Should be Equal ${jsonbody} ${result}
+
+Delete All Tenants
+ [Documentation] Delete all Tenants
+ Add Elements To URI From File ${GBP_TENANTS_API} ${GBP_TENANTS_FILE}
+ ${body} OperatingSystem.Get File ${GBP_TENANTS_FILE}
+ ${jsonbody} To Json ${body}
+ ${resp} RequestsLibrary.Get session ${GBP_TENANTS_API}
+ Should Be Equal As Strings ${resp.status_code} 200
+ Remove All Elements At URI ${GBP_TENANTS_API}
+ ${resp} RequestsLibrary.Get session ${GBP_TENANTS_API}
+ Should Be Equal As Strings ${resp.status_code} 404
+
+Add one Tenant
+ [Documentation] Add one Tenant from JSON file
+ Add Elements To URI From File ${GBP_TENANT1_API} ${GBP_TENANT1_FILE}
+ ${body} OperatingSystem.Get File ${GBP_TENANT1_FILE}
+ ${jsonbody} To Json ${body}
+ ${resp} RequestsLibrary.Get session ${GBP_TENANT1_API}
+ Should Be Equal As Strings ${resp.status_code} 200
+ ${result} To JSON ${resp.content}
+ Lists Should be Equal ${result} ${jsonbody}
+
+Get A Non-existing Tenant
+ [Documentation] Get A Non-existing Tenant
+ Remove All Elements At URI ${GBP_TENANTS_API}
+ ${resp} RequestsLibrary.Get session ${GBP_TENANT1_API}
+ Should Be Equal As Strings ${resp.status_code} 404
+
+Delete one Tenant
+ [Documentation] Delete one Tenant
+ Remove All Elements At URI ${GBP_TENANTS_API}
+ Add Elements To URI From File ${GBP_TENANT1_API} ${GBP_TENANT1_FILE}
+ Remove All Elements At URI ${GBP_TENANT1_API}
+ ${resp} RequestsLibrary.Get session ${GBP_TENANTS_API}
+ Should Be Equal As Strings ${resp.status_code} 200
+ Should Not Contain ${resp.content} ${GBP_TENENT_ID}
+
+Clean Datastore After Tests
+ [Documentation] Clean All Tenants In Datastore After Tests
+ Remove All Elements At URI ${GBP_TENANTS_API}
--- /dev/null
+*** Settings ***
+Documentation Test suite for GBP Tunnels, Operates functions from Restconf APIs.
+Suite Setup Create Session session http://${CONTROLLER}:${RESTCONFPORT} auth=${AUTH} headers=${HEADERS}
+Suite Teardown Delete All Sessions
+Library SSHLibrary
+Library Collections
+Library OperatingSystem
+Library RequestsLibrary
+Variables ../../../variables/Variables.py
+Resource ../../../libraries/Utils.txt
+
+*** Variables ***
+${GBP_TUNNELS_FILE} ../../../variables/gbp/tunnels.json
+${GBP_TUNNEL_ID} openflow:1
+${GBP_TUNNEL1_URL} /restconf/config/opendaylight-inventory:nodes/opendaylight-inventory:node/${GBP_TUNNEL_ID}
+${GBP_TUNNEL1_FILE} ../../../variables/gbp/tunnel1.json
+
+*** Test Cases ***
+Add Tunnels
+ [Documentation] Add Tunnels from JSON file
+ Add Elements To URI From File ${GBP_TUNNELS_API} ${GBP_TUNNELS_FILE}
+ ${body} OperatingSystem.Get File ${GBP_TUNNELS_FILE}
+ ${jsonbody} To Json ${body}
+ ${resp} RequestsLibrary.Get session ${GBP_TUNNELS_API}
+ Should Be Equal As Strings ${resp.status_code} 200
+ ${result} To JSON ${resp.content}
+ Lists Should be Equal ${jsonbody} ${result}
+
+Delete All Tunnels
+ [Documentation] Delete all Tunnels
+ Add Elements To URI From File ${GBP_TUNNELS_API} ${GBP_TUNNELS_FILE}
+ ${body} OperatingSystem.Get File ${GBP_TUNNELS_FILE}
+ ${jsonbody} To Json ${body}
+ ${resp} RequestsLibrary.Get session ${GBP_TUNNELS_API}
+ Should Be Equal As Strings ${resp.status_code} 200
+ Remove All Elements At URI ${GBP_TUNNELS_API}
+ ${resp} RequestsLibrary.Get session ${GBP_TUNNELS_API}
+ Should Be Equal As Strings ${resp.status_code} 404
+
+Add one Tunnel
+ [Documentation] Add one Tunnel from JSON file
+ Add Elements To URI From File ${GBP_TUNNEL1_URL} ${GBP_TUNNEL1_FILE}
+ ${body} OperatingSystem.Get File ${GBP_TUNNEL1_FILE}
+ ${jsonbody} To Json ${body}
+ ${resp} RequestsLibrary.Get session ${GBP_TUNNEL1_URL}
+ Should Be Equal As Strings ${resp.status_code} 200
+ ${result} To JSON ${resp.content}
+ Lists Should be Equal ${result} ${jsonbody}
+
+Get A Non-existing Tunnel
+ [Documentation] Get A Non-existing Tunnel
+ Remove All Elements At URI ${GBP_TUNNELS_API}
+ ${resp} RequestsLibrary.Get session ${GBP_TUNNEL1_URL}
+ Should Be Equal As Strings ${resp.status_code} 404
+
+Delete one Tunnel
+ [Documentation] Delete one Tunnel
+ Remove All Elements At URI ${GBP_TUNNELS_API}
+ Add Elements To URI From File ${GBP_TUNNEL1_URL} ${GBP_TUNNEL1_FILE}
+ Remove All Elements At URI ${GBP_TUNNEL1_URL}
+ ${resp} RequestsLibrary.Get session ${GBP_TUNNELS_API}
+ Should Be Equal As Strings ${resp.status_code} 200
+ Should Not Contain ${resp.content} ${GBP_TUNNEL_ID}
+
+Clean Datastore After Tests
+ [Documentation] Clean All Tunnels In Datastore After Tests
+ Remove All Elements At URI ${GBP_TUNNELS_API}
CREATE_FULLYMESH_TOPOLOGY_FILE = "create_fullymesh.py"
CREATE_FULLYMESH_TOPOLOGY_FILE_PATH = "libraries/MininetTopo/" +\
CREATE_FULLYMESH_TOPOLOGY_FILE
+
+GBP_REGEP_API = "/restconf/operations/endpoint:register-endpoint"
+GBP_UNREGEP_API = "/restconf/operations/endpoint:unregister-endpoint"
+GBP_TENANTS_API = "/restconf/config/policy:tenants"
+GBP_TUNNELS_API = "/restconf/config/opendaylight-inventory:nodes"
--- /dev/null
+{
+ "input": {
+ "endpoint-group": "e593f05d-96be-47ad-acd5-ba81465680d5",
+ "l2-context": "70aeb9ea-4ca1-4fb9-9780-22b04b84a0d6",
+ "l3-address": [
+ {
+ "ip-address": "10.0.36.5",
+ "l3-context": "f2311f52-890f-4095-8b85-485ec8b92b3c"
+ }
+ ],
+ "mac-address": "00:00:00:00:36:05",
+ "ofoverlay:node-connector-id": "openflow:2:4",
+ "ofoverlay:node-id": "openflow:2",
+ "tenant": "f5c7d344-d1c7-4208-8531-2c2693657e12"
+ }
+}
--- /dev/null
+{
+ "tenant": {
+ "contract": [
+ {
+ "clause": [
+ {
+ "name": "allow-http-clause",
+ "subject-refs": [
+ "allow-http-subject",
+ "allow-icmp-subject"
+ ]
+ }
+ ],
+ "id": "22282cca-9a13-4d0c-a67e-a933ebb0b0ae",
+ "subject": [
+ {
+ "name": "allow-http-subject",
+ "rule": [
+ {
+ "classifier-ref": [
+ {
+ "direction": "in",
+ "name": "http-dest"
+ },
+ {
+ "direction": "out",
+ "name": "http-src"
+ }
+ ],
+ "action-ref": [
+ {
+ "name": "allow1",
+ "order": 0
+ }
+ ],
+
+ "name": "allow-http-rule"
+ }
+ ]
+ },
+ {
+ "name": "allow-icmp-subject",
+ "rule": [
+ {
+ "classifier-ref": [
+ {
+ "name": "icmp"
+ }
+ ],
+ "action-ref": [
+ {
+ "name": "allow1",
+ "order": 0
+ }
+ ],
+
+ "name": "allow-icmp-rule"
+ }
+ ]
+ }
+ ]
+ }
+ ],
+ "endpoint-group": [
+ {
+ "consumer-named-selector": [
+ {
+ "contract": [
+ "22282cca-9a13-4d0c-a67e-a933ebb0b0ae"
+ ],
+ "name": "e593f05d-96be-47ad-acd5-ba81465680d5-1eaf9a67-a171-42a8-9282-71cf702f61dd-22282cca-9a13-4d0c-a67e-a933ebb0b0ae"
+ }
+ ],
+ "id": "1eaf9a67-a171-42a8-9282-71cf702f61dd",
+ "network-domain": "d2779562-ebf1-45e6-93a4-78e2362bc418",
+ "provider-named-selector": []
+ },
+ {
+ "consumer-named-selector": [],
+ "id": "e593f05d-96be-47ad-acd5-ba81465680d5",
+ "network-domain": "2c71d675-693e-406f-899f-12a026eb55f1",
+ "provider-named-selector": [
+ {
+ "contract": [
+ "22282cca-9a13-4d0c-a67e-a933ebb0b0ae"
+ ],
+ "name": "e593f05d-96be-47ad-acd5-ba81465680d5-1eaf9a67-a171-42a8-9282-71cf702f61dd-22282cca-9a13-4d0c-a67e-a933ebb0b0ae"
+ }
+ ]
+ }
+ ],
+ "id": "f5c7d344-d1c7-4208-8531-2c2693657e12",
+ "l2-bridge-domain": [
+ {
+ "id": "7b796915-adf4-4356-b5ca-de005ac410c1",
+ "parent": "cbe0cc07-b8ff-451d-8171-9eef002a8e80"
+ }
+ ],
+ "l2-flood-domain": [
+ {
+ "id": "1ddde8d8-c2bc-48d7-8ce0-d78eb6ed4b5b",
+ "parent": "7b796915-adf4-4356-b5ca-de005ac410c1"
+ },
+ {
+ "id": "03f69af2-481c-4554-97d6-c4fedca5d126",
+ "parent": "7b796915-adf4-4356-b5ca-de005ac410c1"
+ }
+ ],
+ "l3-context": [
+ {
+ "id": "cbe0cc07-b8ff-451d-8171-9eef002a8e80"
+ }
+ ],
+ "name": "GBPPOC",
+ "subject-feature-instances": {
+ "classifier-instance": [
+ {
+ "classifier-definition-id": "4250ab32-e8b8-445a-aebb-e1bd2cdd291f",
+ "name": "http-dest",
+ "parameter-value": [
+ {
+ "int-value": "6",
+ "name": "proto"
+ },
+ {
+ "int-value": "80",
+ "name": "destport"
+ }
+ ]
+ },
+ {
+ "classifier-definition-id": "4250ab32-e8b8-445a-aebb-e1bd2cdd291f",
+ "name": "http-src",
+ "parameter-value": [
+ {
+ "int-value": "6",
+ "name": "proto"
+ },
+ {
+ "int-value": "80",
+ "name": "sourceport"
+ }
+ ]
+ },
+ {
+ "classifier-definition-id": "79c6fdb2-1e1a-4832-af57-c65baf5c2335",
+ "name": "icmp",
+ "parameter-value": [
+ {
+ "int-value": "1",
+ "name": "proto"
+ }
+ ]
+ }
+ ],
+ "action-instance": [
+ {
+ "name": "allow1",
+ "action-definition-id": "f942e8fd-e957-42b7-bd18-f73d11266d17"
+ }
+ ]
+ },
+ "subnet": [
+ {
+ "id": "d2779562-ebf1-45e6-93a4-78e2362bc418",
+ "ip-prefix": "10.0.35.1/24",
+ "parent": "1ddde8d8-c2bc-48d7-8ce0-d78eb6ed4b5b",
+ "virtual-router-ip": "10.0.35.1"
+ },
+ {
+ "id": "2c71d675-693e-406f-899f-12a026eb55f1",
+ "ip-prefix": "10.0.36.1/24",
+ "parent": "03f69af2-481c-4554-97d6-c4fedca5d126",
+ "virtual-router-ip": "10.0.36.1"
+ }
+ ]
+ }
+}
--- /dev/null
+{
+"tenants": {
+
+ "tenant": [{
+ "contract": [
+ {
+ "clause": [
+ {
+ "name": "allow-http-clause",
+ "subject-refs": [
+ "allow-http-subject",
+ "allow-icmp-subject"
+ ]
+ }
+ ],
+ "id": "22282cca-9a13-4d0c-a67e-a933ebb0b0ae",
+ "subject": [
+ {
+ "name": "allow-http-subject",
+ "rule": [
+ {
+ "classifier-ref": [
+ {
+ "direction": "in",
+ "name": "http-dest"
+ },
+ {
+ "direction": "out",
+ "name": "http-src"
+ }
+ ],
+ "action-ref": [
+ {
+ "name": "allow1",
+ "order": 0
+ }
+ ],
+
+ "name": "allow-http-rule"
+ }
+ ]
+ },
+ {
+ "name": "allow-icmp-subject",
+ "rule": [
+ {
+ "classifier-ref": [
+ {
+ "name": "icmp"
+ }
+ ],
+ "action-ref": [
+ {
+ "name": "allow1",
+ "order": 0
+ }
+ ],
+
+ "name": "allow-icmp-rule"
+ }
+ ]
+ }
+ ]
+ }
+ ],
+ "endpoint-group": [
+ {
+ "consumer-named-selector": [
+ {
+ "contract": [
+ "22282cca-9a13-4d0c-a67e-a933ebb0b0ae"
+ ],
+ "name": "e593f05d-96be-47ad-acd5-ba81465680d5-1eaf9a67-a171-42a8-9282-71cf702f61dd-22282cca-9a13-4d0c-a67e-a933ebb0b0ae"
+ }
+ ],
+ "id": "1eaf9a67-a171-42a8-9282-71cf702f61dd",
+ "network-domain": "d2779562-ebf1-45e6-93a4-78e2362bc418",
+ "provider-named-selector": []
+ },
+ {
+ "consumer-named-selector": [],
+ "id": "e593f05d-96be-47ad-acd5-ba81465680d5",
+ "network-domain": "2c71d675-693e-406f-899f-12a026eb55f1",
+ "provider-named-selector": [
+ {
+ "contract": [
+ "22282cca-9a13-4d0c-a67e-a933ebb0b0ae"
+ ],
+ "name": "e593f05d-96be-47ad-acd5-ba81465680d5-1eaf9a67-a171-42a8-9282-71cf702f61dd-22282cca-9a13-4d0c-a67e-a933ebb0b0ae"
+ }
+ ]
+ }
+ ],
+ "id": "f5c7d344-d1c7-4208-8531-2c2693657e12",
+ "l2-bridge-domain": [
+ {
+ "id": "7b796915-adf4-4356-b5ca-de005ac410c1",
+ "parent": "cbe0cc07-b8ff-451d-8171-9eef002a8e80"
+ }
+ ],
+ "l2-flood-domain": [
+ {
+ "id": "1ddde8d8-c2bc-48d7-8ce0-d78eb6ed4b5b",
+ "parent": "7b796915-adf4-4356-b5ca-de005ac410c1"
+ },
+ {
+ "id": "03f69af2-481c-4554-97d6-c4fedca5d126",
+ "parent": "7b796915-adf4-4356-b5ca-de005ac410c1"
+ }
+ ],
+ "l3-context": [
+ {
+ "id": "cbe0cc07-b8ff-451d-8171-9eef002a8e80"
+ }
+ ],
+ "name": "GBPPOC",
+ "subject-feature-instances": {
+ "classifier-instance": [
+ {
+ "classifier-definition-id": "4250ab32-e8b8-445a-aebb-e1bd2cdd291f",
+ "name": "http-dest",
+ "parameter-value": [
+ {
+ "int-value": "6",
+ "name": "proto"
+ },
+ {
+ "int-value": "80",
+ "name": "destport"
+ }
+ ]
+ },
+ {
+ "classifier-definition-id": "4250ab32-e8b8-445a-aebb-e1bd2cdd291f",
+ "name": "http-src",
+ "parameter-value": [
+ {
+ "int-value": "6",
+ "name": "proto"
+ },
+ {
+ "int-value": "80",
+ "name": "sourceport"
+ }
+ ]
+ },
+ {
+ "classifier-definition-id": "79c6fdb2-1e1a-4832-af57-c65baf5c2335",
+ "name": "icmp",
+ "parameter-value": [
+ {
+ "int-value": "1",
+ "name": "proto"
+ }
+ ]
+ }
+ ],
+ "action-instance": [
+ {
+ "name": "allow1",
+ "action-definition-id": "f942e8fd-e957-42b7-bd18-f73d11266d17"
+ }
+ ]
+ },
+ "subnet": [
+ {
+ "id": "d2779562-ebf1-45e6-93a4-78e2362bc418",
+ "ip-prefix": "10.0.35.1/24",
+ "parent": "1ddde8d8-c2bc-48d7-8ce0-d78eb6ed4b5b",
+ "virtual-router-ip": "10.0.35.1"
+ },
+ {
+ "id": "2c71d675-693e-406f-899f-12a026eb55f1",
+ "ip-prefix": "10.0.36.1/24",
+ "parent": "03f69af2-481c-4554-97d6-c4fedca5d126",
+ "virtual-router-ip": "10.0.36.1"
+ }
+ ]
+ }]
+
+ }
+}
--- /dev/null
+{
+ "node":
+ {
+ "id": "openflow:1",
+ "ofoverlay:tunnel": [
+ {
+ "tunnel-type": "overlay:tunnel-type-vxlan-gpe",
+ "node-connector-id": "openflow:1:1",
+ "ip": "192.168.50.70",
+ "port": 6633
+ },
+ {
+ "tunnel-type": "overlay:tunnel-type-vxlan",
+ "node-connector-id": "openflow:1:2",
+ "ip": "192.168.50.70",
+ "port": 4789
+ }
+ ]
+ }
+}
--- /dev/null
+{
+ "nodes": {
+ "node": [
+ {
+ "id": "openflow:1",
+ "ofoverlay:tunnel": [
+ {
+ "tunnel-type": "overlay:tunnel-type-vxlan-gpe",
+ "node-connector-id": "openflow:1:1",
+ "ip": "192.168.50.70",
+ "port": 6633
+ },
+ {
+ "tunnel-type": "overlay:tunnel-type-vxlan",
+ "node-connector-id": "openflow:1:2",
+ "ip": "192.168.50.70",
+ "port": 4789
+ }
+ ]
+ },
+ {
+ "id": "openflow:2",
+ "ofoverlay:tunnel": [
+ {
+ "tunnel-type": "overlay:tunnel-type-vxlan-gpe",
+ "node-connector-id": "openflow:2:1",
+ "ip": "192.168.50.71",
+ "port": 6633
+ },
+ {
+ "tunnel-type": "overlay:tunnel-type-vxlan",
+ "node-connector-id": "openflow:2:2",
+ "ip": "192.168.50.71",
+ "port": 4789
+ }
+ ]
+ },
+ {
+ "id": "openflow:3",
+ "ofoverlay:tunnel": [
+ {
+ "tunnel-type": "overlay:tunnel-type-vxlan-gpe",
+ "node-connector-id": "openflow:3:1",
+ "ip": "192.168.50.72",
+ "port": 6633
+ },
+ {
+ "tunnel-type": "overlay:tunnel-type-vxlan",
+ "node-connector-id": "openflow:3:2",
+ "ip": "192.168.50.72",
+ "port": 4789
+ }
+ ]
+ }
+ ]
+ }
+}
--- /dev/null
+{
+ "input": {
+ "l3": [
+ {
+ "ip-address": "10.0.36.5",
+ "l3-context": "f2311f52-890f-4095-8b85-485ec8b92b3c"
+ }
+ ]
+ }
+}