Suite Setup Create Session session http://${CONTROLLER}:${RESTCONFPORT} auth=${AUTH} headers=${HEADERS_XML}
Suite Teardown Delete All Sessions
Library RequestsLibrary
+Library OperatingSystem
Library ../../../libraries/Common.py
Variables ../../../variables/Variables.py
Resource ../../../libraries/Utils.robot
*** Variables ***
-${REST_CONTEXT} /restconf/modules
+${REGISTER_TENANT_FILE} ${CURDIR}/../../../variables/nemo/register-user.json
+${STRUCTURE_HOST_FILE} ${CURDIR}/../../../variables/nemo/intent-node-host.json
+${STRUCTURE_INTENT_FILE} ${CURDIR}/../../../variables/nemo/structure-intent.json
+${PREDEFINE_ROLE_FILE} ${CURDIR}/../../../variables/nemo/predefine/role.json
+${PREDEFINE_NODE_FILE} ${CURDIR}/../../../variables/nemo/predefine/node.json
+${PREDEFINE_CONNECTION_FILE} ${CURDIR}/../../../variables/nemo/predefine/connection.json
*** Test Cases ***
-Get Controller Modules
- [Documentation] Get the controller modules via Restconf
- ${resp} RequestsLibrary.Get session ${REST_CONTEXT}
+Add Pre-define Role
+ [Documentation] Add Pre-define Role
+ [Tags] Put
+ ${body} OperatingSystem.Get File ${PREDEFINE_ROLE_FILE}
+ ${resp} RequestsLibrary.Put session ${PREDEFINE_ROLE_URI} data=${body} headers=${HEADERS_YANG_JSON}
+ Should Be Equal As Strings ${resp.status_code} 200
+
+Add Pre-define Node
+ [Documentation] Add Pre-define Node
+ [Tags] Put
+ ${body} OperatingSystem.Get File ${PREDEFINE_NODE_FILE}
+ ${resp} RequestsLibrary.Put session ${PREDEFINE_NODE_URI} data=${body} headers=${HEADERS_YANG_JSON}
+ Should Be Equal As Strings ${resp.status_code} 200
+
+Add Pre-define Connection
+ [Documentation] Add Pre-define Connection
+ [Tags] Put
+ ${body} OperatingSystem.Get File ${PREDEFINE_CONNECTION_FILE}
+ ${resp} RequestsLibrary.Put session ${PREDEFINE_CONNECTION_URI} data=${body} headers=${HEADERS_YANG_JSON}
+ Should Be Equal As Strings ${resp.status_code} 200
+
+Register Tenant
+ [Documentation] Register Tenant
+ [Tags] Post
+ ${body} OperatingSystem.Get File ${REGISTER_TENANT_FILE}
+ ${resp} RequestsLibrary.Post session ${REGISTER_TENANT_URI} data=${body} headers=${HEADERS_YANG_JSON}
Log ${resp.content}
Should Be Equal As Strings ${resp.status_code} 200
- Should Contain ${resp.content} ietf-restconf
+
+Add Host Intent
+ [Documentation] Add Host Intent
+ [Tags] Post
+ ${body} OperatingSystem.Get File ${STRUCTURE_HOST_FILE}
+ ${resp} RequestsLibrary.Post Request session ${STRUCTURE_INTENT_URI} data=${body} headers=${HEADERS_YANG_JSON}
+ Log ${resp.content}
+ Should Be Equal As Strings ${resp.status_code} 200
+
+Add Structure Intent
+ [Documentation] Add Structure Intent
+ [Tags] Post
+ ${body} OperatingSystem.Get File ${STRUCTURE_INTENT_FILE}
+ ${resp} RequestsLibrary.Post Request session ${STRUCTURE_INTENT_URI} data=${body} headers=${HEADERS_YANG_JSON}
+ Should Be Equal As Strings ${resp.status_code} 200
OPERATIONAL_API = '/restconf/operational'
MODULES_API = '/restconf/modules'
+# NEMO Variables
+PREDEFINE_ROLE_URI = '/restconf/config/nemo-user:user-roles'
+PREDEFINE_NODE_URI = '/restconf/config/nemo-object:node-definitions'
+PREDEFINE_CONNECTION_URI = '/restconf/config/nemo-object:connection-definitions'
+REGISTER_TENANT_URI = '/restconf/operations/nemo-intent:register-user'
+STRUCTURE_INTENT_URI = '/restconf/operations/nemo-intent:structure-style-nemo-update'
+GET_INTENTS_URI = '/retconf/config/intent:intents'
+
# TOKEN
AUTH_TOKEN_API = '/oauth2/token'
REVOKE_TOKEN_API = '/oauth2/revoke'
TOPOLOGY_URL = 'network-topology:network-topology/topology'
SEND_ACCEPT_XML_HEADERS = {'Content-Type': 'application/xml', 'Accept': 'application/xml'}
-# Test deadlines global control
-ENABLE_GLOBAL_TEST_DEADLINES = True
-
# Deprecated old variables, to be removed once all tests that need them are
# updated to use the new names.
CONTROLLER = ODL_SYSTEM_IP
--- /dev/null
+{
+ "input":{
+ "user-id": "14ce424a-3e50-4a2a-ad5c-b29845158c8b",
+ "objects":{
+ "node":[
+ {
+ "node-name": "server1",
+ "node-type": "host",
+ "node-id":"7b796915-adf4-4356-b5ca-de005ac410c1"
+ },
+ {
+ "node-name": "server2",
+ "node-type": "host",
+ "node-id":"22282cca-9a13-4d0c-a67e-a933ebb0b0ae"
+ },
+ {
+ "node-name": "vm1",
+ "node-type": "host",
+ "node-id":"1eaf9a67-a171-42a8-9282-71cf702f61dd"
+ },
+ {
+ "node-name": "vm2",
+ "node-type": "host",
+ "node-id":"6c787caa-156a-49ed-8546-547bdccf283c"
+ }
+ ]
+ }
+ }
+}
--- /dev/null
+{
+ "connection-definitions": {
+ "connection-definition":[
+ {
+ "connection-type": "p2p",
+ "property-definition": [
+ {
+ "property-name": "bandwidth",
+ "property-value-type": "int"
+ }
+ ]
+ },
+ {
+ "connection-type": "p2mp",
+ "property-definition": [
+ {
+ "property-name": "bandwidth",
+ "property-value-type": "int"
+ }
+ ]
+ },
+ {
+ "connection-type": "mesh",
+ "property-definition": [
+ {
+ "property-name": "bandwidth",
+ "property-value-type": "int"
+ }
+ ]
+ },
+ {
+ "connection-type": "chain",
+ "property-definition": [
+ {
+ "property-name": "bandwidth",
+ "property-value-type": "int"
+ }
+ ]
+ }
+ ]
+ }
+}
--- /dev/null
+{
+ "node-definitions": {
+ "node-definition": [
+ {
+ "node-type": "host",
+ "property-definition": [
+ {
+ "property-name": "name",
+ "property-value-type": "string"
+ },
+ {
+ "property-name": "location",
+ "property-value-type": "string"
+ },
+ {
+ "property-name": "mac-address",
+ "property-value-type": "string"
+ },
+ {
+ "property-name": "ip-address",
+ "property-value-type": "string"
+ }
+ ]
+ },
+ {
+ "node-type": "l2-group",
+ "property-definition": [
+ {
+ "property-name": "ip-prefix",
+ "property-value-type": "string"
+ },
+ {
+ "property-name": "gateway-ip",
+ "property-value-type": "string"
+ },
+ {
+ "property-name": "location",
+ "property-value-type": "string"
+ }
+ ]
+ },
+ {
+ "node-type": "l3-group",
+ "property-definition": [
+ {
+ "property-name": "ip-prefix",
+ "property-value-type": "string"
+ }
+ ]
+ },
+ {
+ "node-type": "ext-group",
+ "property-definition": [
+ {
+ "property-name": "location",
+ "property-value-type": "string",
+ "is-required": "required"
+ },
+ {
+ "property-name": "ac-info-network",
+ "property-value-type": "string",
+ "is-required": "required"
+ },
+ {
+ "property-name": "ac-info-protocol",
+ "property-value-type": "string",
+ "is-required": "required"
+ },
+ {
+ "property-name": "ip-prefix",
+ "property-value-type": "string"
+ }
+ ]
+ },
+ {
+ "node-type": "chain-group"
+ },
+ {
+ "node-type": "fw",
+ "property-definition": [
+ {
+ "property-name": "location",
+ "property-value-type": "string",
+ "is-required": "required"
+ },
+ {
+ "property-name": "operating-mode",
+ "property-value-type": "string",
+ "is-required": "required"
+ }
+ ]
+ },
+ {
+ "node-type": "lb",
+ "property-definition": [
+ {
+ "property-name": "location",
+ "property-value-type": "string",
+ "is-required": "required"
+ },
+ {
+ "property-name": "operating-mode",
+ "property-value-type": "string",
+ "is-required": "required"
+ }
+ ]
+ },
+ {
+ "node-type": "cache",
+ "property-definition": [
+ {
+ "property-name": "location",
+ "property-value-type": "string",
+ "is-required": "required"
+ },
+ {
+ "property-name": "operating-mode",
+ "property-value-type": "string",
+ "is-required": "required"
+ }
+ ]
+ }
+ ]
+ }
+}
--- /dev/null
+{
+ "user-roles": {
+ "user-role": [
+ {
+ "role-name": "tenant",
+ "role-description": "It's a non-administor user"
+ }
+ ]
+ }
+}
--- /dev/null
+{
+ "input":{
+ "user-id":"14ce424a-3e50-4a2a-ad5c-b29845158c8b",
+ "user-name":"user2",
+ "user-password":"abc",
+ "user-role":"tenant"
+ }
+}
\ No newline at end of file
--- /dev/null
+{
+ "input":{
+ "user-id": "14ce424a-3e50-4a2a-ad5c-b29845158c8b",
+ "objects":{
+ "node":[
+ {
+ "node-name": "dmz",
+ "node-type": "l2-group",
+ "sub-node": [
+ {
+ "node-id":"7b796915-adf4-4356-b5ca-de005ac410c1",
+ "order":"0"
+ }
+ ],
+ "property": [
+ {
+ "property-name": "location",
+ "property-values": {
+ "string-value": [
+ {
+ "order": "0",
+ "value": "openflow:3"
+ }
+ ]
+ }
+ },
+ {
+ "property-name": "ip-prefix",
+ "property-values": {
+ "string-value": [
+ {
+ "order": "0",
+ "value": "192.168.11.0/24"
+ }
+ ]
+ }
+ },
+ {
+ "property-name": "gateway-ip",
+ "property-values": {
+ "string-value": [
+ {
+ "order": "0",
+ "value": "192.168.11.1"
+ }
+ ]
+ }
+ }
+ ],
+ "node-id": "b46cfa7f-93a3-43f4-ac20-09307c75feca"
+ },
+ {
+ "node-name": "interior",
+ "node-type": "l2-group",
+ "sub-node": [
+ {
+ "node-id":"22282cca-9a13-4d0c-a67e-a933ebb0b0ae",
+ "order":"0"
+ },
+ {
+ "node-id":"1eaf9a67-a171-42a8-9282-71cf702f61dd",
+ "order":"0"
+ }
+ ],
+ "property": [
+ {
+ "property-name": "location",
+ "property-values": {
+ "string-value": [
+ {
+ "order": "0",
+ "value": "openflow:3"
+ }
+ ]
+ }
+ },
+ {
+ "property-name": "ip-prefix",
+ "property-values": {
+ "string-value": [
+ {
+ "order": "0",
+ "value": "192.168.12.0/24"
+ }
+ ]
+ }
+ },
+ {
+ "property-name": "gateway-ip",
+ "property-values": {
+ "string-value": [
+ {
+ "order": "0",
+ "value": "192.168.12.1"
+ }
+ ]
+ }
+ }
+ ],
+ "node-id": "175425f7-c9c9-474a-962c-70cb6c180d4d"
+ }
+ ],
+ "connection":[
+ {
+ "connection-name": "c1",
+ "connection-id": "e0d56fee-7235-4748-a2a1-eb5e3733d866",
+ "end-node": [
+ {
+ "order": "0",
+ "node-id": "b46cfa7f-93a3-43f4-ac20-09307c75feca"
+ },
+ {
+ "order": "0",
+ "node-id": "175425f7-c9c9-474a-962c-70cb6c180d4d"
+ }
+ ],
+ "connection-type": "p2p"
+ }
+ ],
+ "flow":[
+ {
+ "match-item": [
+ {
+ "match-item-value": {
+ "string-value": "192.168.12.0/24"
+ },
+ "match-item-name": "src-ip"
+ },
+ {
+ "match-item-value": {
+ "string-value": "192.168.11.0/24"
+ },
+ "match-item-name": "dst-ip"
+ }
+ ],
+ "flow-id": "cf48eeee-882e-435a-adf4-ea22ba88331f",
+ "flow-name": "f1"
+ }
+ ]
+ },
+ "operations":{
+ "operation":[
+ {
+ "operation-name": "o1",
+ "target-object": "cf48eeee-882e-435a-adf4-ea22ba88331f",
+ "priority":"0",
+ "operation-id": "619ee3bb-1e40-480f-b0fa-a331820a5518",
+ "action":[
+ {
+ "action-name":"allow",
+ "order":"0"
+ }
+ ]
+ }
+ ]
+ }
+ }
+}