${ODL_VERSION} Be
*** Keywords ***
+Authentication Key Should Be
+ [Arguments] ${resp} ${password}
+ [Documentation] Check if the authentication key in the ${resp} is ${password}
+ ${authkey}= Get Authentication Key ${resp}
+ Should Be Equal As Strings ${authkey} ${password}
+
+Get Authentication Key
+ [Arguments] ${resp}
+ ${output}= Get From Dictionary ${resp.json()} output
+ ${authkey}= Run Keyword If "${ODL_VERSION}" == "Li" Get Authentication Key Lithium ${output}
+ ... ELSE Get Authentication Key Beryllium ${output}
+ [Return] ${authkey}
+
+Get Authentication Key Beryllium
+ [Arguments] ${output}
+ ${mapping_authkey}= Get From Dictionary ${output} mapping-authkey
+ ${authkey}= Get From Dictionary ${mapping_authkey} key-string
+ [Return] ${authkey}
+
+Get Authentication Key Lithium
+ [Arguments] ${output}
+ ${authkey}= Get From Dictionary ${output} authkey
+ [Return] ${authkey}
+
+Ipv4 Rloc Should Be
+ [Arguments] ${resp} ${address}
+ [Documentation] Check if the RLOC in the ${resp} is ${address}
+ ${eid_record}= Get Eid Record ${resp}
+ ${loc_record}= Get From Dictionary ${eid_record} LocatorRecord
+ ${loc_record_0}= Get From List ${loc_record} 0
+ ${ipv4}= Get Ipv4 Rloc ${loc_record_0}
+ Should Be Equal As Strings ${ipv4} ${address}
+
+Get Eid Record
+ [Arguments] ${resp}
+ ${output}= Get From Dictionary ${resp.json()} output
+ ${eid_record}= Run Keyword If "${ODL_VERSION}" == "Li" Get Eid Record Lithium ${output}
+ ... ELSE Get Eid Record Beryllium ${output}
+ [Return] ${eid_record}
+
+Get Eid Record Beryllium
+ [Arguments] ${output}
+ ${eid_record}= Get From Dictionary ${output} mapping-record
+ [Return] ${eid_record}
+
+Get Eid Record Lithium
+ [Arguments] ${output}
+ ${eid_record}= Get From Dictionary ${output} eidToLocatorRecord
+ ${eid_record}= Get From List ${eid_record} 0
+ [Return] ${eid_record}
+
+Get Ipv4 Rloc
+ [Arguments] ${loc_record}
+ ${ipv4}= Run Keyword If "${ODL_VERSION}" == "Li" Get Ipv4 Rloc Lithium ${loc_record}
+ ... ELSE Get Ipv4 Rloc Beryllium ${loc_record}
+ [Return] ${ipv4}
+
+Get Ipv4 Rloc Beryllium
+ [Arguments] ${loc_record}
+ ${loc}= Get From Dictionary ${loc_record} rloc
+ ${ipv4}= Get From Dictionary ${loc} ipv4
+ [Return] ${ipv4}
+
+Get Ipv4 Rloc Lithium
+ [Arguments] ${loc_record}
+ ${loc}= Get From Dictionary ${loc_record} LispAddressContainer
+ ${address}= Get From Dictionary ${loc} Ipv4Address
+ ${ipv4}= Get From Dictionary ${address} Ipv4Address
+ [Return] ${ipv4}
+
Check Mapping Removal
[Arguments] ${json}
Run Keyword If "${ODL_VERSION}" == "Li" Check Mapping Removal Lithium ${json}
Resource ../../../libraries/Utils.robot
*** Variables ***
-${IPV4_C_KEY} ${CURDIR}/../../../variables/lispflowmapping/rpc_add-key_ipv4.json
-${IPV4_RD} ${CURDIR}/../../../variables/lispflowmapping/rpc_get-remove_ipv4.json
-${MISS_RD} ${CURDIR}/../../../variables/lispflowmapping/rpc_get-remove_missing.json
-${IPV4_U_KEY} ${CURDIR}/../../../variables/lispflowmapping/rpc_update-key_ipv4.json
-${IPV4_C_MAP} ${CURDIR}/../../../variables/lispflowmapping/rpc_add-mapping_ipv4_ipv4.json
-${IPV4_U_MAP} ${CURDIR}/../../../variables/lispflowmapping/rpc_update-mapping_ipv4_ipv4.json
+${IPV4_C_KEY} ${CURDIR}/../../../variables/lispflowmapping/${ODL_VERSION}/rpc_add-key_ipv4.json
+${IPV4_RD} ${CURDIR}/../../../variables/lispflowmapping/${ODL_VERSION}/rpc_get-remove_ipv4.json
+${MISS_RD} ${CURDIR}/../../../variables/lispflowmapping/${ODL_VERSION}/rpc_get-remove_missing.json
+${IPV4_U_KEY} ${CURDIR}/../../../variables/lispflowmapping/${ODL_VERSION}/rpc_update-key_ipv4.json
+${IPV4_C_MAP} ${CURDIR}/../../../variables/lispflowmapping/${ODL_VERSION}/rpc_add-mapping_ipv4_ipv4.json
+${IPV4_U_MAP} ${CURDIR}/../../../variables/lispflowmapping/${ODL_VERSION}/rpc_update-mapping_ipv4_ipv4.json
*** Test Cases ***
Create Key
[Documentation] Read an existing key for an IPv4 EID
${get_key}= OperatingSystem.Get File ${IPV4_RD}
${resp}= Post Log Check ${LFM_RPC_API}:get-key ${get_key}
- ${output}= Get From Dictionary ${resp.json()} output
- ${password}= Get From Dictionary ${output} authkey
- Should Be Equal As Strings ${password} password
+ Authentication Key Should Be ${resp} password
Update Key
[Documentation] Update an existing key for an IPv4 EID
[Documentation] Read the key updated in the previous test
${get_key}= OperatingSystem.Get File ${IPV4_RD}
${resp}= Post Log Check ${LFM_RPC_API}:get-key ${get_key}
- ${output}= Get From Dictionary ${resp.json()} output
- ${password}= Get From Dictionary ${output} authkey
- Should Be Equal As Strings ${password} updated-password
+ Authentication Key Should Be ${resp} updated-password
Delete Key
[Documentation] Delete an existing key for an IPv4 EID
[Documentation] Read an existing mapping for an IPv4 EID
${get_mapping}= OperatingSystem.Get File ${IPV4_RD}
${resp}= Post Log Check ${LFM_RPC_API}:get-mapping ${get_mapping}
- ${output}= Get From Dictionary ${resp.json()} output
- ${eid_record}= Get From Dictionary ${output} eidToLocatorRecord
- ${eid_record_0}= Get From List ${eid_record} 0
- ${loc_record}= Get From Dictionary ${eid_record_0} LocatorRecord
- ${loc_record_0}= Get From List ${loc_record} 0
- ${loc}= Get From Dictionary ${loc_record_0} LispAddressContainer
- ${address}= Get From Dictionary ${loc} Ipv4Address
- ${ipv4}= Get From Dictionary ${address} Ipv4Address
- Should Be Equal As Strings ${ipv4} 10.10.10.10
+ Ipv4 Rloc Should Be ${resp} 10.10.10.10
Update Mapping
[Documentation] Update an existing mapping for an IPv4 EID
[Documentation] Read the mapping updated in the previous test
${get_mapping}= OperatingSystem.Get File ${IPV4_RD}
${resp}= Post Log Check ${LFM_RPC_API}:get-mapping ${get_mapping}
- ${output}= Get From Dictionary ${resp.json()} output
- ${eid_record}= Get From Dictionary ${output} eidToLocatorRecord
- ${eid_record_0}= Get From List ${eid_record} 0
- ${loc_record}= Get From Dictionary ${eid_record_0} LocatorRecord
- ${loc_record_0}= Get From List ${loc_record} 0
- ${loc}= Get From Dictionary ${loc_record_0} LispAddressContainer
- ${address}= Get From Dictionary ${loc} Ipv4Address
- ${ipv4}= Get From Dictionary ${address} Ipv4Address
- Should Be Equal As Strings ${ipv4} 20.20.20.20
+ Ipv4 Rloc Should Be ${resp} 20.20.20.20
Delete Mapping
[Documentation] Delete an existing mapping for an IPv4 EID
Resource ../../../libraries/Utils.robot
*** Variables ***
-${IPV4_C_MAP} ${CURDIR}/../../../variables/lispflowmapping/rpc_add-mapping_ipv4_ipv4.json
-${IPV4_RD} ${CURDIR}/../../../variables/lispflowmapping/rpc_get-remove_ipv4.json
-${IPV6_C_MAP} ${CURDIR}/../../../variables/lispflowmapping/rpc_add-mapping_ipv6_ipv4.json
-${IPV6_RD} ${CURDIR}/../../../variables/lispflowmapping/rpc_get-remove_ipv6.json
-${MAC_C_MAP} ${CURDIR}/../../../variables/lispflowmapping/rpc_add-mapping_mac_ipv4.json
-${MAC_RD} ${CURDIR}/../../../variables/lispflowmapping/rpc_get-remove_mac.json
-${DN_C_MAP} ${CURDIR}/../../../variables/lispflowmapping/rpc_add-mapping_dn_ipv4.json
-${DN_RD} ${CURDIR}/../../../variables/lispflowmapping/rpc_get-remove_dn.json
-${AS_C_MAP} ${CURDIR}/../../../variables/lispflowmapping/rpc_add-mapping_as_ipv4.json
-${AS_RD} ${CURDIR}/../../../variables/lispflowmapping/rpc_get-remove_as.json
-${IID_C_MAP} ${CURDIR}/../../../variables/lispflowmapping/rpc_add-mapping_iid_ipv4.json
-${IID_RD} ${CURDIR}/../../../variables/lispflowmapping/rpc_get-remove_iid.json
-${SD_C_MAP} ${CURDIR}/../../../variables/lispflowmapping/rpc_add-mapping_srcdst_ipv4.json
-${SD_RD} ${CURDIR}/../../../variables/lispflowmapping/rpc_get-remove_srcdst.json
-${KV_C_MAP} ${CURDIR}/../../../variables/lispflowmapping/rpc_add-mapping_kv_ipv4.json
-${KV_RD} ${CURDIR}/../../../variables/lispflowmapping/rpc_get-remove_kv.json
-${LST_C_MAP} ${CURDIR}/../../../variables/lispflowmapping/rpc_add-mapping_ipv4_list.json
-${APP_C_MAP} ${CURDIR}/../../../variables/lispflowmapping/rpc_add-mapping_ipv4_appdata.json
-${ELP_C_MAP} ${CURDIR}/../../../variables/lispflowmapping/rpc_add-mapping_ipv4_elp.json
+${IPV4_C_MAP} ${CURDIR}/../../../variables/lispflowmapping/${ODL_VERSION}/rpc_add-mapping_ipv4_ipv4.json
+${IPV4_RD} ${CURDIR}/../../../variables/lispflowmapping/${ODL_VERSION}/rpc_get-remove_ipv4.json
+${IPV6_C_MAP} ${CURDIR}/../../../variables/lispflowmapping/${ODL_VERSION}/rpc_add-mapping_ipv6_ipv4.json
+${IPV6_RD} ${CURDIR}/../../../variables/lispflowmapping/${ODL_VERSION}/rpc_get-remove_ipv6.json
+${MAC_C_MAP} ${CURDIR}/../../../variables/lispflowmapping/${ODL_VERSION}/rpc_add-mapping_mac_ipv4.json
+${MAC_RD} ${CURDIR}/../../../variables/lispflowmapping/${ODL_VERSION}/rpc_get-remove_mac.json
+${DN_C_MAP} ${CURDIR}/../../../variables/lispflowmapping/${ODL_VERSION}/rpc_add-mapping_dn_ipv4.json
+${DN_RD} ${CURDIR}/../../../variables/lispflowmapping/${ODL_VERSION}/rpc_get-remove_dn.json
+${AS_C_MAP} ${CURDIR}/../../../variables/lispflowmapping/${ODL_VERSION}/rpc_add-mapping_as_ipv4.json
+${AS_RD} ${CURDIR}/../../../variables/lispflowmapping/${ODL_VERSION}/rpc_get-remove_as.json
+${IID_C_MAP} ${CURDIR}/../../../variables/lispflowmapping/${ODL_VERSION}/rpc_add-mapping_iid_ipv4.json
+${IID_RD} ${CURDIR}/../../../variables/lispflowmapping/${ODL_VERSION}/rpc_get-remove_iid.json
+${SD_C_MAP} ${CURDIR}/../../../variables/lispflowmapping/${ODL_VERSION}/rpc_add-mapping_srcdst_ipv4.json
+${SD_RD} ${CURDIR}/../../../variables/lispflowmapping/${ODL_VERSION}/rpc_get-remove_srcdst.json
+${KV_C_MAP} ${CURDIR}/../../../variables/lispflowmapping/${ODL_VERSION}/rpc_add-mapping_kv_ipv4.json
+${KV_RD} ${CURDIR}/../../../variables/lispflowmapping/${ODL_VERSION}/rpc_get-remove_kv.json
+${LST_C_MAP} ${CURDIR}/../../../variables/lispflowmapping/${ODL_VERSION}/rpc_add-mapping_ipv4_list.json
+${APP_C_MAP} ${CURDIR}/../../../variables/lispflowmapping/${ODL_VERSION}/rpc_add-mapping_ipv4_appdata.json
+${ELP_C_MAP} ${CURDIR}/../../../variables/lispflowmapping/${ODL_VERSION}/rpc_add-mapping_ipv4_elp.json
*** Test Cases ***
IPv4 Prefix
Post Log Check ${LFM_RPC_API}:add-mapping ${add_mapping}
Sleep 200ms Avoid race conditions
${resp}= Post Log Check ${LFM_RPC_API}:get-mapping ${get_mapping}
- ${output}= Get From Dictionary ${resp.json()} output
- ${eid_record}= Get From Dictionary ${output} eidToLocatorRecord
- ${eid_record_0}= Get From List ${eid_record} 0
- Dictionary Should Contain Key ${eid_record_0} LocatorRecord
+ ${eid_record}= Get Eid Record ${resp}
+ Dictionary Should Contain Key ${eid_record} LocatorRecord
Remove Datatype And Check Removal
Variable Should Exist ${RPC_Datatype__current_json}
GBP_TUNNELS_API = "/restconf/config/opendaylight-inventory:nodes"
# LISP Flow Mapping variables
-LFM_RPC_API = "/restconf/operations/mappingservice"
+LFM_RPC_API = "/restconf/operations/odl-mappingservice"
LFM_RPC_API_LI = "/restconf/operations/lfm-mapping-database"
-LFM_SB_RPC_API = "/restconf/operations/lisp-sb"
+LFM_SB_RPC_API = "/restconf/operations/odl-lisp-sb"
# Other global variables
# TODO: Move these to more apropriate sections.
--- /dev/null
+{
+ "input": {
+ "eid": {
+ "address-type": "ietf-lisp-address-types:ipv4-prefix-afi",
+ "ipv4-prefix": "192.0.2.1/32"
+ },
+ "mapping-authkey": {
+ "key-string": "password",
+ "key-type": 1
+ }
+ }
+}
--- /dev/null
+{
+ "input": {
+ "mapping-record": {
+ "recordTtl": 1440,
+ "action": "NoAction",
+ "authoritative": true,
+ "eid": {
+ "address-type": "ietf-lisp-address-types:as-number-afi",
+ "as-number": 64500
+ },
+ "LocatorRecord": [
+ {
+ "locator-id": "ISP1",
+ "priority": 1,
+ "weight": 1,
+ "multicastPriority": 255,
+ "multicastWeight": 0,
+ "localLocator": true,
+ "rlocProbed": false,
+ "routed": false,
+ "rloc": {
+ "address-type": "ietf-lisp-address-types:ipv4-afi",
+ "ipv4": "10.10.10.10"
+ }
+ }
+ ]
+ }
+ }
+}
--- /dev/null
+{
+ "input": {
+ "mapping-record": {
+ "recordTtl": 1440,
+ "action": "NoAction",
+ "authoritative": true,
+ "eid": {
+ "address-type": "ietf-lisp-address-types:distinguished-name-afi",
+ "distinguished-name": "stringAsIs"
+ },
+ "LocatorRecord": [
+ {
+ "locator-id": "ISP1",
+ "priority": 1,
+ "weight": 1,
+ "multicastPriority": 255,
+ "multicastWeight": 0,
+ "localLocator": true,
+ "rlocProbed": false,
+ "routed": false,
+ "rloc": {
+ "address-type": "ietf-lisp-address-types:ipv4-afi",
+ "ipv4": "10.10.10.10"
+ }
+ }
+ ]
+ }
+ }
+}
--- /dev/null
+{
+ "input": {
+ "mapping-record": {
+ "recordTtl": 1440,
+ "action": "NoAction",
+ "authoritative": true,
+ "eid": {
+ "address-type": "ietf-lisp-address-types:instance-id-lcaf",
+ "instance-id": {
+ "iid": 1,
+ "mask-length": 32,
+ "address": "192.0.2.0/32"
+ }
+ },
+ "LocatorRecord": [
+ {
+ "locator-id": "ISP1",
+ "priority": 1,
+ "weight": 1,
+ "multicastPriority": 255,
+ "multicastWeight": 0,
+ "localLocator": true,
+ "rlocProbed": false,
+ "routed": false,
+ "rloc": {
+ "address-type": "ietf-lisp-address-types:ipv4-afi",
+ "ipv4": "10.10.10.10"
+ }
+ }
+ ]
+ }
+ }
+}
--- /dev/null
+{
+ "input": {
+ "mapping-record": {
+ "recordTtl": 1440,
+ "action": "NoAction",
+ "authoritative": true,
+ "eid": {
+ "address-type": "ietf-lisp-address-types:ipv4-prefix-afi",
+ "ipv4-prefix": "192.0.2.1/32"
+ },
+ "LocatorRecord": [
+ {
+ "locator-id": "ISP1",
+ "priority": 1,
+ "weight": 1,
+ "multicastPriority": 255,
+ "multicastWeight": 0,
+ "localLocator": true,
+ "rlocProbed": false,
+ "routed": false,
+ "rloc": {
+ "address-type": "ietf-lisp-address-types:application-data-lcaf",
+ "application-data": {
+ "address": "10.10.10.10",
+ "protocol": 17,
+ "ip-tos": 128,
+ "local-port-low": 80,
+ "local-port-high": 81,
+ "remote-port-low": 6667,
+ "remote-port-high": 7000
+ }
+ }
+ }
+ ]
+ }
+ }
+}
--- /dev/null
+{
+ "input": {
+ "mapping-record": {
+ "recordTtl": 1440,
+ "action": "NoAction",
+ "authoritative": true,
+ "eid": {
+ "address-type": "ietf-lisp-address-types:ipv4-prefix-afi",
+ "ipv4-prefix": "192.0.2.1/32"
+ },
+ "LocatorRecord": [
+ {
+ "locator-id": "ISP1",
+ "priority": 1,
+ "weight": 1,
+ "multicastPriority": 255,
+ "multicastWeight": 0,
+ "localLocator": true,
+ "rlocProbed": false,
+ "routed": false,
+ "rloc": {
+ "address-type": "ietf-lisp-address-types:explicit-locator-path-lcaf",
+ "explicit-locator-path": {
+ "hop": [
+ {
+ "hop-id": "Hop 1",
+ "address": "20.20.20.20",
+ "lrs-bits": "lookup rloc-probe strict"
+ },
+ {
+ "hop-id": "Hop 2",
+ "address": "30.30.30.30",
+ "lrs-bits": "lookup strict"
+ }
+ ]
+ }
+ }
+ }
+ ]
+ }
+ }
+}
--- /dev/null
+{
+ "input": {
+ "mapping-record": {
+ "recordTtl": 1440,
+ "action": "NoAction",
+ "authoritative": true,
+ "eid": {
+ "address-type": "ietf-lisp-address-types:ipv4-prefix-afi",
+ "ipv4-prefix": "192.0.2.1/32"
+ },
+ "LocatorRecord": [
+ {
+ "locator-id": "ISP1",
+ "priority": 1,
+ "weight": 1,
+ "multicastPriority": 255,
+ "multicastWeight": 0,
+ "localLocator": true,
+ "rlocProbed": false,
+ "routed": false,
+ "rloc": {
+ "address-type": "ietf-lisp-address-types:ipv4-afi",
+ "ipv4": "10.10.10.10"
+ }
+ }
+ ]
+ }
+ }
+}
--- /dev/null
+{
+ "input": {
+ "mapping-record": {
+ "recordTtl": 1440,
+ "action": "NoAction",
+ "authoritative": true,
+ "eid": {
+ "address-type": "ietf-lisp-address-types:ipv4-prefix-afi",
+ "ipv4-prefix": "192.0.2.1/32"
+ },
+ "LocatorRecord": [
+ {
+ "locator-id": "ISP1",
+ "priority": 1,
+ "weight": 1,
+ "multicastPriority": 255,
+ "multicastWeight": 0,
+ "localLocator": true,
+ "rlocProbed": false,
+ "routed": false,
+ "rloc": {
+ "address-type": "ietf-lisp-address-types:afi-list-lcaf",
+ "afi-list": {
+ "address-list": [
+ "10.10.10.10",
+ "2001:db8::1"
+ ]
+ }
+ }
+ }
+ ]
+ }
+ }
+}
--- /dev/null
+{
+ "input": {
+ "mapping-record": {
+ "recordTtl": 1440,
+ "action": "NoAction",
+ "authoritative": true,
+ "eid": {
+ "address-type": "ietf-lisp-address-types:ipv6-prefix-afi",
+ "ipv6-prefix": "2001:db8::1/128"
+ },
+ "LocatorRecord": [
+ {
+ "locator-id": "ISP1",
+ "priority": 1,
+ "weight": 1,
+ "multicastPriority": 255,
+ "multicastWeight": 0,
+ "localLocator": true,
+ "rlocProbed": false,
+ "routed": false,
+ "rloc": {
+ "address-type": "ietf-lisp-address-types:ipv4-afi",
+ "ipv4": "10.10.10.10"
+ }
+ }
+ ]
+ }
+ }
+}
--- /dev/null
+{
+ "input": {
+ "mapping-record": {
+ "recordTtl": 1440,
+ "action": "NoAction",
+ "authoritative": true,
+ "eid": {
+ "address-type": "ietf-lisp-address-types:key-value-address-lcaf",
+ "key-value-address": {
+ "key": "192.0.2.1",
+ "value": "192.0.2.2"
+ }
+ },
+ "LocatorRecord": [
+ {
+ "locator-id": "ISP1",
+ "priority": 1,
+ "weight": 1,
+ "multicastPriority": 255,
+ "multicastWeight": 0,
+ "localLocator": true,
+ "rlocProbed": false,
+ "routed": false,
+ "rloc": {
+ "address-type": "ietf-lisp-address-types:ipv4-afi",
+ "ipv4": "10.10.10.10"
+ }
+ }
+ ]
+ }
+ }
+}
--- /dev/null
+{
+ "input": {
+ "mapping-record": {
+ "recordTtl": 1440,
+ "action": "NoAction",
+ "authoritative": true,
+ "eid": {
+ "address-type": "ietf-lisp-address-types:mac-afi",
+ "mac": "00:11:22:33:44:55"
+ },
+ "LocatorRecord": [
+ {
+ "locator-id": "ISP1",
+ "priority": 1,
+ "weight": 1,
+ "multicastPriority": 255,
+ "multicastWeight": 0,
+ "localLocator": true,
+ "rlocProbed": false,
+ "routed": false,
+ "rloc": {
+ "address-type": "ietf-lisp-address-types:ipv4-afi",
+ "ipv4": "10.10.10.10"
+ }
+ }
+ ]
+ }
+ }
+}
--- /dev/null
+{
+ "input": {
+ "mapping-record": {
+ "recordTtl": 1440,
+ "action": "NoAction",
+ "authoritative": true,
+ "eid": {
+ "address-type": "ietf-lisp-address-types:source-dest-key-lcaf",
+ "source-dest-key": {
+ "source": "192.0.2.1/32",
+ "dest": "192.0.2.2/32"
+ }
+ },
+ "LocatorRecord": [
+ {
+ "locator-id": "ISP1",
+ "priority": 1,
+ "weight": 1,
+ "multicastPriority": 255,
+ "multicastWeight": 0,
+ "localLocator": true,
+ "rlocProbed": false,
+ "routed": false,
+ "rloc": {
+ "address-type": "ietf-lisp-address-types:ipv4-afi",
+ "ipv4": "10.10.10.10"
+ }
+ }
+ ]
+ }
+ }
+}
--- /dev/null
+{
+ "input": {
+ "eid": {
+ "address-type": "ietf-lisp-address-types:as-number-afi",
+ "as-number": 64500
+ }
+ }
+}
--- /dev/null
+{
+ "input": {
+ "eid": {
+ "address-type": "ietf-lisp-address-types:distinguished-name-afi",
+ "distinguished-name": "stringAsIs"
+ }
+ }
+}
--- /dev/null
+{
+ "input": {
+ "eid": {
+ "address-type": "ietf-lisp-address-types:instance-id-lcaf",
+ "instance-id": {
+ "iid": 1,
+ "mask-length": 32,
+ "address": "192.0.2.0/32"
+ }
+ }
+ }
+}
--- /dev/null
+{
+ "input": {
+ "eid": {
+ "address-type": "ietf-lisp-address-types:ipv4-prefix-afi",
+ "ipv4-prefix": "192.0.2.1/32"
+ }
+ }
+}
--- /dev/null
+{
+ "input": {
+ "eid": {
+ "address-type": "ietf-lisp-address-types:ipv6-prefix-afi",
+ "ipv6-prefix": "2001:db8::1/128"
+ }
+ }
+}
--- /dev/null
+{
+ "input": {
+ "eid": {
+ "address-type": "ietf-lisp-address-types:key-value-address-lcaf",
+ "key-value-address": {
+ "key": "192.0.2.1",
+ "value": "192.0.2.2"
+ }
+ }
+ }
+}
--- /dev/null
+{
+ "input": {
+ "eid": {
+ "address-type": "ietf-lisp-address-types:mac-afi",
+ "mac": "00:11:22:33:44:55"
+ }
+ }
+}
--- /dev/null
+{
+ "input": {
+ "eid": {
+ "address-type": "ietf-lisp-address-types:ipv4-prefix-afi",
+ "ipv4-prefix": "192.0.2.255/32"
+ }
+ }
+}
--- /dev/null
+{
+ "input": {
+ "eid": {
+ "address-type": "ietf-lisp-address-types:source-dest-key-lcaf",
+ "source-dest-key": {
+ "source": "192.0.2.1/32",
+ "dest": "192.0.2.2/32"
+ }
+ }
+ }
+}
--- /dev/null
+{
+ "input": {
+ "eid": {
+ "address-type": "ietf-lisp-address-types:ipv4-prefix-afi",
+ "ipv4-prefix": "192.0.2.1/32"
+ },
+ "mapping-authkey": {
+ "key-string": "updated-password",
+ "key-type": 1
+ }
+ }
+}
--- /dev/null
+{
+ "input": {
+ "mapping-record": {
+ "recordTtl": 1440,
+ "action": "NoAction",
+ "authoritative": true,
+ "eid": {
+ "address-type": "ietf-lisp-address-types:ipv4-prefix-afi",
+ "ipv4-prefix": "192.0.2.1/32"
+ },
+ "LocatorRecord": [
+ {
+ "locator-id": "ISP1",
+ "priority": 1,
+ "weight": 1,
+ "multicastPriority": 255,
+ "multicastWeight": 0,
+ "localLocator": true,
+ "rlocProbed": false,
+ "routed": false,
+ "rloc": {
+ "address-type": "ietf-lisp-address-types:ipv4-afi",
+ "ipv4": "20.20.20.20"
+ }
+ }
+ ]
+ }
+ }
+}
getheaders = {'Accept': 'application/json'}
RPC_URL_LI = 'restconf/operations/lfm-mapping-database:'
- RPC_URL_BE = 'restconf/operations/mappingservice:'
+ RPC_URL_BE = 'restconf/operations/odl-mappingservice:'
TIMEOUT = 10
# Template for adding mappings
add_mapping_template = {
u'input': {
- u'recordTtl': 60,
- u'maskLength': 32,
- u'authoritative': True,
- u'action': u'NoAction',
- u'LispAddressContainer': {
- u'Ipv4Address': {
- u'afi': 1,
- u'Ipv4Address': u'10.0.0.0'
- }
- },
- u'LocatorRecord': [
- {
- u'name': u'ipv4:172.16.0.0',
- u'priority': 1,
- u'weight': 1,
- u'multicastPriority': 255,
- u'multicastWeight': 0,
- u'localLocator': True,
- u'rlocProbed': False,
- u'routed': True,
- u'LispAddressContainer': {
- u'Ipv4Address': {
- u'afi': 1,
- u'Ipv4Address': u'172.16.0.0'
+ u'mapping-record': {
+ u'recordTtl': 60,
+ u'action': u'NoAction',
+ u'authoritative': True,
+ u'eid': {
+ u'address-type':
+ u'ietf-lisp-address-types:ipv4-prefix-afi',
+ u'ipv4-prefix': u'10.0.0.0/32'
+ },
+ u'LocatorRecord': [
+ {
+ u'locator-id': u'ipv4:172.16.0.0',
+ u'priority': 1,
+ u'weight': 1,
+ u'multicastPriority': 255,
+ u'multicastWeight': 0,
+ u'localLocator': True,
+ u'rlocProbed': False,
+ u'routed': True,
+ u'rloc': {
+ u'address-type':
+ u'ietf-lisp-address-types:ipv4-afi',
+ u'ipv4': u'172.16.0.0'
}
}
- }
- ]
+ ]
+ }
}
}
# Template for getting mappings
get_mapping_template = {
u'input': {
- u'LispAddressContainer': {
- u'Ipv4Address': {
- u'afi': 1,
- u'Ipv4Address': u'10.0.0.0'
- }
- },
- u'mask-length': 32
+ u'eid': {
+ u'ipv4-prefix': u'10.0.0.0'
+ }
}
}
Returns:
:return dict: mapping - template modified with the arguments
"""
- mapping = copy.deepcopy(self.add_mapping_template['input'])
- mapping['maskLength'] = mask
- mapping['LispAddressContainer']['Ipv4Address']['Ipv4Address'] \
- = str(netaddr.IPAddress(eid))
- mapping['LocatorRecord'][0]['name'] = 'ipv4:' \
+ mapping = copy.deepcopy(
+ self.add_mapping_template['input']['mapping-record'])
+ mapping['eid']['ipv4-prefix'] = str(netaddr.IPAddress(eid)) \
+ + '/' + mask
+ mapping['LocatorRecord'][0]['locator-id'] = 'ipv4:' \
+ str(netaddr.IPAddress(rloc))
- address_container = mapping['LocatorRecord'][0]['LispAddressContainer']
- address_container['Ipv4Address']['Ipv4Address'] \
+ mapping['LocatorRecord'][0]['rloc']['ipv4'] \
= str(netaddr.IPAddress(rloc))
return mapping
rpc = dict(self.add_mapping_template)
increment = pow(2, 32 - int(self.mask))
for i in range(self.nmappings):
- rpc['input'] = self.mapping_from_tpl(self.start_eid + i *
- increment, self.mask,
- self.start_rloc + i)
+ rpc['input']['mapping-record'] = self.mapping_from_tpl(
+ self.start_eid + i * increment, self.mask,
+ self.start_rloc + i)
rpc_json = json.dumps(rpc)
self.send_rpc(self.session, 'add-mapping', rpc_json)
self.session.close()
increment = pow(2, 32 - int(self.mask))
for i in range(self.nmappings):
eid = self.start_eid + i * increment
- rpc['input']['LispAddressContainer']['Ipv4Address']['Ipv4Address']\
- = str(netaddr.IPAddress(eid))
- rpc['input']['mask-length'] = self.mask
+ rpc['input']['eid']['ipv4-prefix'] = str(netaddr.IPAddress(eid)) \
+ + '/' + self.mask
rpc_json = json.dumps(rpc)
self.send_rpc(self.session, 'get-mapping', rpc_json)
self.session.close()