diff options
author | Maros Marsalek <mmarsale@cisco.com> | 2016-06-08 20:51:32 +0200 |
---|---|---|
committer | Maros Marsalek <mmarsale@cisco.com> | 2016-06-09 18:24:23 +0200 |
commit | 625b421f3c28e0457f039017b1160662d622f4bc (patch) | |
tree | 05ae48d1bf8963fcdf001c060662a0bc648ef5db /v3po | |
parent | fb65fe09c385a898743a0cc7f480fcc16676526e (diff) |
HONEYCOMB-62: Add Ip readers
+ Fix 1 interface reads. Interface reader worked only
if GET interfaces-state was executed
+ Fix readSubtree for augmentations. Comoposite readers did
not check child readers for augmentations, only direct children.
Change-Id: I2bc433e3e5785453062ab262b9edabc72c333bf0
Signed-off-by: Maros Marsalek <mmarsale@cisco.com>
Diffstat (limited to 'v3po')
14 files changed, 730 insertions, 337 deletions
diff --git a/v3po/postman_rest_collection.json b/v3po/postman_rest_collection.json index da3808154..ff01afd87 100644 --- a/v3po/postman_rest_collection.json +++ b/v3po/postman_rest_collection.json @@ -1,90 +1,102 @@ { - "id": "61475d83-1808-fa49-7ca6-32f701e38b19", + "id": "7c35192d-9085-20f6-9fcd-3f8570aaefd7", "name": "Honeycomb RESTCONF calls", "description": "Common mgmt operations on VPP using Honeycomb REST interface", "order": [ - "1ff26126-1cfe-898f-f068-cbeecd0c3366", - "c2b623b7-7110-3f81-1f73-482eca7bb41e", - "eeeb8b70-d222-6d9a-6521-1e16bf8db401", - "f19bf50c-b847-a7a0-cabe-31b2cf23b745", - "fce0239b-0d55-5578-e216-51a7a0f57cc4", - "0405ec33-82d8-4183-fcd7-6201d8eeb48f", - "7b848cbb-b41b-8855-8d8a-8438a415e5ad", - "bc3ade2a-51de-cb6d-f2c1-ee0598a8cb8a", - "be7a6dc3-144e-be00-76e5-34395f8eb76f", - "84f9c4e9-f5d9-7e73-a95d-b657c7c9b24f" + "286f2d2d-88eb-ad68-7c6f-43caecc6073e", + "d27322b8-59d5-a2dc-a7a2-8f7197057164", + "5dc1d9f4-e7ae-bb21-e558-8a56ac825922", + "2f1d8e0d-4961-4b7f-50ad-0210e52e59aa", + "93022e97-24fa-5784-1e59-94674817215f", + "8b867c90-459f-68f6-4b2e-fa653098c28d", + "e611d23a-c205-192b-e8f9-dd99fa169274", + "3fccc4cd-f14b-0333-83d5-924afe3938e4", + "77383f38-941c-a136-99a6-91f9799a0b06", + "86db54f1-a60b-98d4-2639-a845d1305141" ], "folders": [ { - "id": "4ff8ebe4-bd44-681a-7093-9422424099b1", + "id": "7a914134-23ea-3154-1557-d29dc8d464e7", + "name": "IP", + "description": "", + "order": [ + "945138cf-d1f0-4674-b221-7b271010be42", + "a95120a1-5661-edc4-30cf-53afeb104440", + "6c5c9786-3619-ccaf-c276-0ada45711b70", + "3a93e78e-21ec-e0c9-94df-c69b60d9edcd" + ], + "owner": "45557" + }, + { + "id": "60596aab-a4f1-bb64-d701-816de9482201", "name": "TAP", "description": "", "order": [ - "7d71e781-31a9-3274-659d-474bdf74ed70", - "56f60295-995b-1ea3-9934-b81fe23545f7", - "77360902-d830-f4df-684a-c6c2f28111ec", - "d46e1911-cf84-3805-a085-2219a49a7557" + "3f9588e4-885f-3792-bdf4-d0f10704ae4d", + "27106942-aff5-6ab5-07ae-5315135297a1", + "4db9b360-0d57-6ce6-7e3c-a6acfe17d512", + "5995dcf7-51c0-42ef-448b-a70bb68735d5" ], - "owner": "652751" + "owner": "45557" }, { - "id": "0bca9dad-0798-f750-91ba-cc6ff8f277d5", + "id": "c97b9ad9-64e6-5de3-09b8-851c1189d767", "name": "VHOST", "description": "", "order": [ - "95a948ed-5345-939b-280c-74f97920343e", - "d14a1086-43f2-f595-5c20-cba8b8f6a992", - "2e8634e0-4272-9b06-e237-7748437be978" + "7f312f15-a81e-b513-83b7-a5f7755eae67", + "ac161bec-e046-4bb7-d695-60bdfb0c6cea", + "55102dbd-1fc9-5f91-2082-40a2dc311f4f" ], - "owner": "652751" + "owner": "45557" }, { - "id": "ba52e764-f1ec-b1cc-747f-54681ed93859", + "id": "37fd9569-06e3-1f08-fbcc-4b1462107a32", "name": "VLAN", "description": "", "order": [ - "4f803d8f-a351-63bd-b624-36e839ccacc3", - "b638b979-fa1f-2658-cea0-934c4b809986", - "d51282d3-2348-fcee-cbf8-ba2552034280", - "67ead758-b466-a312-2f5d-f4d3f1b18368", - "4a1f9526-8eb8-cc18-6993-c750a16bd4cf", - "7b436781-e157-b9db-fc18-157161e9ce04", - "698368ca-5fd3-fb7e-9e80-6030a03b15d0", - "33083a0e-d40e-01fc-fc9f-06dda676cc97" + "2ca639f4-f4a4-07c7-9419-79fd66061458", + "27eb70b8-a191-dd5c-f106-6693086ce872", + "f2e9a3cb-f3cc-f501-6015-8ebf7d8b2c3e", + "cbb77318-52e0-5647-cd1c-8c679ea7b830", + "8b339568-b60a-715f-d4fd-416bafe981a9", + "bd2897c6-5fc7-bec5-87be-4fd52bb8e471", + "44de3eff-ace5-90a9-dd16-af3f5f13daad", + "b08a0677-6b59-74ea-e5c6-7383194b19dd" ], - "owner": "652751", + "owner": "45557", "collectionId": "e9ba4e80-fb4d-1eae-07e7-97b323164130" }, { - "id": "e89467a0-a016-7da6-0adf-2fbc1f45687e", + "id": "288569d0-e425-7877-4fd9-a82e8a340ade", "name": "VXLAN-GPE-TUNNEL", "description": "", "order": [ - "a7a7c0f3-4dea-09f5-8c28-be3d7e084331", - "6cc428c7-72c2-35c5-5232-3d378d906557" + "0f223706-ca7f-fb8f-60ed-2b18e769e344", + "203ea32c-e43a-669c-4f28-232926df6928" ], - "owner": "652751" + "owner": "45557" }, { - "id": "f8061658-c931-5f3c-c119-857c8b1508b1", + "id": "3868e66d-0ee5-bd4d-6b35-075c4841b5c1", "name": "VXLAN-TUNNEL", "description": "", "order": [ - "2b2b62dc-5530-971e-c6d5-03afd3fcbf0a", - "f0faabc8-eab8-bb4d-1042-b45716ecb155" + "f014ab21-8e40-c344-a68b-0f1b86578bd8", + "4f15d0e9-8530-157e-0fe8-d24034bc31df" ], - "owner": "652751" + "owner": "45557" } ], "timestamp": 1460119141419, - "owner": "652751", + "owner": "45557", "remoteLink": "", "public": false, "requests": [ { - "id": "0405ec33-82d8-4183-fcd7-6201d8eeb48f", + "id": "0f223706-ca7f-fb8f-60ed-2b18e769e344", "headers": "Authorization: Basic YWRtaW46YWRtaW4=\nContent-Type: application/json\n", - "url": "http://localhost:8181/restconf/config/ietf-interfaces:interfaces/interface/local0", + "url": "http://localhost:8181/restconf/config/ietf-interfaces:interfaces/interface/vxlanGpeTun3", "preRequestScript": "", "pathVariables": {}, "method": "PUT", @@ -94,37 +106,39 @@ "tests": "", "currentHelper": "normal", "helperAttributes": {}, - "time": 1460540047356, - "name": "Enable local0 interface - cfg", + "time": 1464768006369, + "name": "Add vxlan-gpe - cfg", "description": "", - "collectionId": "61475d83-1808-fa49-7ca6-32f701e38b19", + "collectionId": "7c35192d-9085-20f6-9fcd-3f8570aaefd7", "responses": [], - "rawModeData": "{\r\n \r\n \"interface\": [\r\n {\r\n \"name\": \"local0\",\r\n \"description\": \"for testing purposes\",\r\n \"type\": \"iana-if-type:ethernetCsmacd\",\r\n \"enabled\": \"true\",\r\n \"v3po:ethernet\": {\r\n \"mtu\": 64\r\n }\r\n }\r\n ]\r\n \r\n}" + "rawModeData": "{\r\n \r\n \"interface\": [\r\n {\r\n \"name\": \"vxlanGpeTun3\",\r\n \"description\": \"for testing purposes\",\r\n \"type\": \"v3po:vxlan-gpe-tunnel\",\r\n \"enabled\": \"true\",\r\n \"link-up-down-trap-enable\": \"enabled\",\r\n \"routing\" : {\r\n \"vrf-id\" : \"0\"\r\n },\r\n \"vxlan-gpe\" : {\r\n \"local\" : \"192.168.50.76\",\r\n \"remote\" : \"192.168.50.71\",\r\n \"vni\" : \"9\",\r\n \"next-protocol\" : \"ethernet\",\r\n \"encap-vrf-id\" : \"0\",\r\n \"decap-vrf-id\" : \"0\"\r\n }\r\n }\r\n ]\r\n \r\n}", + "folder": "288569d0-e425-7877-4fd9-a82e8a340ade" }, { - "id": "1ff26126-1cfe-898f-f068-cbeecd0c3366", + "id": "203ea32c-e43a-669c-4f28-232926df6928", "headers": "Authorization: Basic YWRtaW46YWRtaW4=\nContent-Type: application/json\n", - "url": "http://localhost:8181/restconf/config/ietf-interfaces:interfaces/", + "url": "http://localhost:8181/restconf/config/ietf-interfaces:interfaces/interface/vxlanGpeTun3", "preRequestScript": "", "pathVariables": {}, - "method": "GET", + "method": "DELETE", "data": [], "dataMode": "raw", "version": 2, "tests": "", "currentHelper": "normal", "helperAttributes": {}, - "time": 1460539962712, - "name": "List ifcs - cfg", - "description": "List ifcs - cfg", - "collectionId": "61475d83-1808-fa49-7ca6-32f701e38b19", + "time": 1464764638498, + "name": "Delete vxlan-gpe - cfg", + "description": "", + "collectionId": "7c35192d-9085-20f6-9fcd-3f8570aaefd7", "responses": [], - "rawModeData": "{\r\n \r\n \"interface\": [\r\n {\r\n \"name\": \"testInterface\",\r\n \"description\": \"for testing purposes\",\r\n \"type\": \"iana-if-type:ethernetCsmacd\",\r\n \"enabled\": \"true\",\r\n \"link-up-down-trap-enable\": \"enabled\",\r\n \"ietf-ip:ipv4\": {\r\n \"enabled\": \"true\",\r\n \"mtu\": \"1500\",\r\n \"address\": [\r\n {\r\n \"ip\": \"1.2.3.0\",\r\n \"netmask\": \"255.255.255.0\"\r\n }\r\n ]\r\n }\r\n }\r\n ]\r\n \r\n}" + "rawModeData": "", + "folder": "288569d0-e425-7877-4fd9-a82e8a340ade" }, { - "id": "2b2b62dc-5530-971e-c6d5-03afd3fcbf0a", + "id": "27106942-aff5-6ab5-07ae-5315135297a1", "headers": "Authorization: Basic YWRtaW46YWRtaW4=\nContent-Type: application/json\n", - "url": "http://localhost:8181/restconf/config/ietf-interfaces:interfaces/interface/vxlanTun1", + "url": "http://localhost:8181/restconf/config/ietf-interfaces:interfaces/interface/tapp2", "preRequestScript": "", "pathVariables": {}, "method": "PUT", @@ -134,119 +148,119 @@ "tests": "", "currentHelper": "normal", "helperAttributes": {}, - "time": 1464767860505, - "name": "Add virtual ifc - cfg", + "time": 1462796722186, + "name": "Add complex tap ifc - cfg", "description": "", - "collectionId": "61475d83-1808-fa49-7ca6-32f701e38b19", + "collectionId": "7c35192d-9085-20f6-9fcd-3f8570aaefd7", "responses": [], - "rawModeData": "{\r\n \r\n \"interface\": [\r\n {\r\n \"name\": \"vxlanTun1\",\r\n \"description\": \"for testing purposes\",\r\n \"type\": \"v3po:vxlan-tunnel\",\r\n \"enabled\": \"true\",\r\n \"link-up-down-trap-enable\": \"enabled\",\r\n \"routing\" : {\r\n \"vrf-id\" : \"0\"\r\n },\r\n \"vxlan\" : {\r\n \"src\" : \"192.168.1.6\",\r\n \"dst\" : \"192.168.1.9\",\r\n \"vni\" : \"88\",\r\n \"encap-vrf-id\" : \"0\"\r\n }\r\n }\r\n ]\r\n \r\n}" + "rawModeData": "{\r\n \r\n \"interface\": [\r\n {\r\n \"name\": \"tapp2\",\r\n \"description\": \"for testing purposes\",\r\n \"type\": \"v3po:tap\",\r\n \"tap\" :{\r\n \"tap-name\" : \"tapp2\",\r\n \"mac\" : \"00:ff:ff:ff:ff:ff\",\r\n \"device-instance\" : 55\r\n }\r\n }\r\n ]\r\n \r\n}", + "folder": "60596aab-a4f1-bb64-d701-816de9482201" }, { - "id": "2e8634e0-4272-9b06-e237-7748437be978", + "id": "27eb70b8-a191-dd5c-f106-6693086ce872", "headers": "Authorization: Basic YWRtaW46YWRtaW4=\nContent-Type: application/json\n", - "url": "http://localhost:8181/restconf/config/ietf-interfaces:interfaces/interface/vhost1", + "url": "http://localhost:8181/restconf/config/ietf-interfaces:interfaces/interface/GigabitEthernet0%2F9%2F0", "preRequestScript": "", "pathVariables": {}, - "method": "DELETE", + "method": "PUT", "data": [], "dataMode": "raw", "version": 2, "tests": "", "currentHelper": "normal", - "helperAttributes": "{}", - "time": 1462891488523, - "name": "Delete vhost user ifc - cfg", - "description": "Deletes vhost user interface.\nCorresponding vpp CLI command:\n\nvppctl delete vhost-user sw_if_index [index]\n\nTo verify invoke:\n\nvppctl show vhost-user\n\nor\n\nvppctl show int", - "collectionId": "61475d83-1808-fa49-7ca6-32f701e38b19", + "helperAttributes": {}, + "time": 1464804325716, + "name": "Enable GigabitEthernet0/9/0 interface - cfg", + "description": "Enables GigabitEthernet0/9/0 interface. Equivalent vppctl command:\n\nvppctl set in state GigabitEthernet0/9/0 up\n\nNeeded to enable sub interface.\n\nTo verify invoke:\n\nvppctl show int", + "collectionId": "7c35192d-9085-20f6-9fcd-3f8570aaefd7", "responses": [], - "folder": "0bca9dad-0798-f750-91ba-cc6ff8f277d5", - "rawModeData": "", - "descriptionFormat": null + "folder": "37fd9569-06e3-1f08-fbcc-4b1462107a32", + "rawModeData": "{\r\n \r\n \"interface\": [\r\n {\r\n \"name\": \"GigabitEthernet0/9/0\",\r\n \"type\": \"iana-if-type:ethernetCsmacd\",\r\n \"v3po:ethernet\": {\r\n \"mtu\": 9216\r\n },\r\n \"enabled\": true,\r\n \"vpp-vlan:sub-interfaces\": {\r\n \"sub-interface\": [\r\n {\r\n \"identifier\": 1,\r\n \"vlan-type\": \"802dot1q\",\r\n \"tags\": {\r\n \"tag\": [\r\n {\r\n \"index\": 1,\r\n \"dot1q-tag\": {\r\n \"tag-type\": \"dot1q-types:c-vlan\",\r\n \"vlan-id\": \"any\"\r\n }\r\n },\r\n {\r\n \"index\": 0,\r\n \"dot1q-tag\": {\r\n \"tag-type\": \"dot1q-types:s-vlan\",\r\n \"vlan-id\": \"100\"\r\n }\r\n }\r\n ]\r\n },\r\n \"match\": {\r\n \"vlan-tagged\": {\r\n \"match-exact-tags\": true\r\n }\r\n },\r\n \"enabled\": false\r\n }\r\n ]\r\n }\r\n }\r\n ]\r\n \r\n}" }, { - "id": "56f60295-995b-1ea3-9934-b81fe23545f7", + "id": "286f2d2d-88eb-ad68-7c6f-43caecc6073e", "headers": "Authorization: Basic YWRtaW46YWRtaW4=\nContent-Type: application/json\n", - "url": "http://localhost:8181/restconf/config/ietf-interfaces:interfaces/interface/tapp2", + "url": "http://localhost:8181/restconf/config/ietf-interfaces:interfaces/", "preRequestScript": "", "pathVariables": {}, - "method": "PUT", + "method": "GET", "data": [], "dataMode": "raw", "version": 2, "tests": "", "currentHelper": "normal", "helperAttributes": {}, - "time": 1462796722186, - "name": "Add complex tap ifc - cfg", - "description": "", - "collectionId": "61475d83-1808-fa49-7ca6-32f701e38b19", + "time": 1460539962712, + "name": "List ifcs - cfg", + "description": "List ifcs - cfg", + "collectionId": "7c35192d-9085-20f6-9fcd-3f8570aaefd7", "responses": [], - "rawModeData": "{\r\n \r\n \"interface\": [\r\n {\r\n \"name\": \"tapp2\",\r\n \"description\": \"for testing purposes\",\r\n \"type\": \"v3po:tap\",\r\n \"tap\" :{\r\n \"tap-name\" : \"tapp2\",\r\n \"mac\" : \"00:ff:ff:ff:ff:ff\",\r\n \"device-instance\" : 55\r\n }\r\n }\r\n ]\r\n \r\n}", - "folder": "4ff8ebe4-bd44-681a-7093-9422424099b1" + "rawModeData": "{\r\n \r\n \"interface\": [\r\n {\r\n \"name\": \"testInterface\",\r\n \"description\": \"for testing purposes\",\r\n \"type\": \"iana-if-type:ethernetCsmacd\",\r\n \"enabled\": \"true\",\r\n \"link-up-down-trap-enable\": \"enabled\",\r\n \"ietf-ip:ipv4\": {\r\n \"enabled\": \"true\",\r\n \"mtu\": \"1500\",\r\n \"address\": [\r\n {\r\n \"ip\": \"1.2.3.0\",\r\n \"netmask\": \"255.255.255.0\"\r\n }\r\n ]\r\n }\r\n }\r\n ]\r\n \r\n}" }, { - "id": "6cc428c7-72c2-35c5-5232-3d378d906557", + "id": "2ca639f4-f4a4-07c7-9419-79fd66061458", "headers": "Authorization: Basic YWRtaW46YWRtaW4=\nContent-Type: application/json\n", - "url": "http://localhost:8181/restconf/config/ietf-interfaces:interfaces/interface/vxlanGpeTun3", + "url": "http://localhost:8181/restconf/config/ietf-interfaces:interfaces/interface/GigabitEthernet0%2F9%2F0/vpp-vlan:sub-interfaces/sub-interface/1", "preRequestScript": "", "pathVariables": {}, - "method": "DELETE", + "method": "PUT", "data": [], "dataMode": "raw", "version": 2, "tests": "", "currentHelper": "normal", "helperAttributes": {}, - "time": 1464764638498, - "name": "Delete vxlan-gpe - cfg", - "description": "", - "collectionId": "61475d83-1808-fa49-7ca6-32f701e38b19", + "time": 1464804304987, + "name": "Add sub interface - cfg", + "description": "Adds sub interface. Corresponsing vpp cli command:\n\nvppctl create sub GigabitEthernet0/9/0 1 dot1q 100 inner-dot1q any\n\nTo verify run:\n./build-root/install-vpp-native/vpp-api-test/bin/vpp_api_test json\nand invoke:\n\n#vat sw_interface_dump", + "collectionId": "7c35192d-9085-20f6-9fcd-3f8570aaefd7", "responses": [], - "rawModeData": "" + "folder": "37fd9569-06e3-1f08-fbcc-4b1462107a32", + "rawModeData": "{\r\n \"sub-interface\": [\r\n {\r\n \"identifier\": \"1\",\r\n \"vlan-type\": \"802dot1q\",\r\n \"tags\": {\r\n \"tag\": [\r\n {\r\n \"index\": \"0\",\r\n \"dot1q-tag\": {\r\n \"tag-type\": \"dot1q-types:s-vlan\",\r\n \"vlan-id\": \"100\"\r\n }\r\n },\r\n {\r\n \"index\": \"1\",\r\n \"dot1q-tag\": {\r\n \"tag-type\": \"dot1q-types:c-vlan\",\r\n \"vlan-id\": \"any\"\r\n }\r\n }\r\n ]\r\n },\r\n \"match\": {\r\n \"vlan-tagged\": {\r\n \"match-exact-tags\": \"true\"\r\n }\r\n },\r\n \"enabled\": \"false\"\r\n }\r\n ]\r\n}" }, { - "id": "77360902-d830-f4df-684a-c6c2f28111ec", + "id": "2f1d8e0d-4961-4b7f-50ad-0210e52e59aa", "headers": "Authorization: Basic YWRtaW46YWRtaW4=\nContent-Type: application/json\n", - "url": "http://localhost:8181/restconf/config/ietf-interfaces:interfaces/interface/tapp2", + "url": "http://localhost:8181/restconf/config/v3po:vpp", "preRequestScript": "", "pathVariables": {}, - "method": "PUT", + "method": "GET", "data": [], "dataMode": "raw", "version": 2, "tests": "", "currentHelper": "normal", "helperAttributes": {}, - "time": 1462796801468, - "name": "Modify complex tap ifc - cfg", + "time": 1460540006597, + "name": "Read vpp - cfg", "description": "", - "collectionId": "61475d83-1808-fa49-7ca6-32f701e38b19", + "collectionId": "7c35192d-9085-20f6-9fcd-3f8570aaefd7", "responses": [], - "rawModeData": "{\r\n \r\n \"interface\": [\r\n {\r\n \"name\": \"tapp2\",\r\n \"description\": \"for testing purposes\",\r\n \"type\": \"v3po:tap\",\r\n \"tap\" :{\r\n \"tap-name\" : \"tapp2\",\r\n \"mac\" : \"00:ff:ff:ff:ff:ae\",\r\n \"device-instance\" : 77\r\n }\r\n }\r\n ]\r\n \r\n}", - "folder": "4ff8ebe4-bd44-681a-7093-9422424099b1" + "rawModeData": "{\r\n \r\n \"interface\": [\r\n {\r\n \"name\": \"testInterface\",\r\n \"description\": \"for testing purposes\",\r\n \"type\": \"iana-if-type:ethernetCsmacd\",\r\n \"enabled\": \"true\",\r\n \"link-up-down-trap-enable\": \"enabled\",\r\n \"ietf-ip:ipv4\": {\r\n \"enabled\": \"true\",\r\n \"mtu\": \"1500\",\r\n \"address\": [\r\n {\r\n \"ip\": \"1.2.3.0\",\r\n \"netmask\": \"255.255.255.0\"\r\n }\r\n ]\r\n }\r\n }\r\n ]\r\n \r\n}" }, { - "id": "7b848cbb-b41b-8855-8d8a-8438a415e5ad", + "id": "3a93e78e-21ec-e0c9-94df-c69b60d9edcd", "headers": "Authorization: Basic YWRtaW46YWRtaW4=\nContent-Type: application/json\n", - "url": "http://localhost:8181/restconf/config/ietf-interfaces:interfaces", + "url": "http://localhost:8181/restconf/config/ietf-interfaces:interfaces/interface/local0/ipv4", "preRequestScript": "", "pathVariables": {}, - "method": "PUT", + "method": "GET", "data": [], "dataMode": "raw", "version": 2, "tests": "", "currentHelper": "normal", "helperAttributes": {}, - "time": 1460636113690, - "name": "Set interfaces bulk edit - cfg", + "time": 1465473589796, + "name": "Read local0/ipv4 - cfg", "description": "", - "collectionId": "61475d83-1808-fa49-7ca6-32f701e38b19", + "collectionId": "7c35192d-9085-20f6-9fcd-3f8570aaefd7", "responses": [], - "rawModeData": "{\n \"interfaces\": {\n \"interface\": [\n {\n \"name\": \"pg/stream-2\",\n \"enabled\": true,\n \"type\": \"iana-if-type:ethernetCsmacd\"\n },\n {\n \"name\": \"pg/stream-3\",\n \"enabled\": true,\n \"type\": \"iana-if-type:ethernetCsmacd\"\n },\n {\n \"name\": \"pg/stream-0\",\n \"enabled\": true,\n \"type\": \"iana-if-type:ethernetCsmacd\"\n },\n {\n \"name\": \"local0\",\n \"description\": \"for testing purposes\",\n \"type\": \"iana-if-type:ethernetCsmacd\",\n \"enabled\": true\n },\n {\n \"name\": \"pg/stream-1\",\n \"enabled\": true,\n \"type\": \"iana-if-type:ethernetCsmacd\"\n }\n ]\n }\n}" + "folder": "7a914134-23ea-3154-1557-d29dc8d464e7", + "rawModeData": "{\r\n \r\n \"interface\": [\r\n {\r\n \"name\": \"testInterface\",\r\n \"description\": \"for testing purposes\",\r\n \"type\": \"iana-if-type:ethernetCsmacd\",\r\n \"enabled\": \"true\",\r\n \"link-up-down-trap-enable\": \"enabled\",\r\n \"ietf-ip:ipv4\": {\r\n \"enabled\": \"true\",\r\n \"mtu\": \"1500\",\r\n \"address\": [\r\n {\r\n \"ip\": \"1.2.3.0\",\r\n \"netmask\": \"255.255.255.0\"\r\n }\r\n ]\r\n }\r\n }\r\n ]\r\n \r\n}" }, { - "id": "7d71e781-31a9-3274-659d-474bdf74ed70", + "id": "3f9588e4-885f-3792-bdf4-d0f10704ae4d", "headers": "Authorization: Basic YWRtaW46YWRtaW4=\nContent-Type: application/json\n", "url": "http://localhost:8181/restconf/config/ietf-interfaces:interfaces/interface/tapp", "preRequestScript": "", @@ -261,14 +275,14 @@ "time": 1462535811974, "name": "Add simple tap ifc -cfg", "description": "", - "collectionId": "61475d83-1808-fa49-7ca6-32f701e38b19", + "collectionId": "7c35192d-9085-20f6-9fcd-3f8570aaefd7", "responses": [], - "folder": "4ff8ebe4-bd44-681a-7093-9422424099b1", + "folder": "60596aab-a4f1-bb64-d701-816de9482201", "rawModeData": "{\r\n \r\n \"interface\": [\r\n {\r\n \"name\": \"tapp\",\r\n \"description\": \"for testing purposes\",\r\n \"type\": \"v3po:tap\",\r\n \"tap\" :{\r\n \"tap-name\" : \"tapp\"\r\n }\r\n }\r\n ]\r\n \r\n}" }, { - "id": "84f9c4e9-f5d9-7e73-a95d-b657c7c9b24f", - "headers": "Content-Type: application/json\nAuthorization: Basic YWRtaW46YWRtaW4=\n", + "id": "3fccc4cd-f14b-0333-83d5-924afe3938e4", + "headers": "Authorization: Basic YWRtaW46YWRtaW4=\nContent-Type: application/json\n", "url": "http://localhost:8181/restconf/config/ietf-interfaces:interfaces/interface/local0", "preRequestScript": "", "pathVariables": {}, @@ -279,17 +293,17 @@ "tests": "", "currentHelper": "normal", "helperAttributes": {}, - "time": 1462534221488, - "name": "Add local0 to bridge domain", - "description": "Adds l2 interconnection of bridge-based type to local0 interface\n\nTo verify invoke:\n\nvppctl show bridge-domain [bd_id] detail", - "collectionId": "61475d83-1808-fa49-7ca6-32f701e38b19", + "time": 1460640004531, + "name": "Set vrf id for local0 - cfg", + "description": "", + "collectionId": "7c35192d-9085-20f6-9fcd-3f8570aaefd7", "responses": [], - "rawModeData": "{\n \"interface\": [\n {\n \"name\": \"local0\",\n \"description\": \"for testing purposes\",\n \"type\": \"iana-if-type:ethernetCsmacd\",\n \"v3po:routing\": {\n \"vrf-id\": 7\n },\n \"v3po:ethernet\": {\n \"mtu\": 64\n },\n \"enabled\": true,\n \"v3po:l2\": {\n \"bridge-domain\": \"testBD\",\n \"split-horizon-group\": \"0\",\n \"bridged-virtual-interface\": \"false\"\n }\n }\n ]\n}" + "rawModeData": "{\r\n \r\n \"interface\": [\r\n {\r\n \"name\": \"local0\",\r\n \"description\": \"for testing purposes only\",\r\n \"type\": \"iana-if-type:ethernetCsmacd\",\r\n \"enabled\": \"true\",\r\n \"routing\" : {\r\n \"vrf-id\" : \"7\"\r\n },\r\n \"v3po:ethernet\": {\r\n \"mtu\": 64\r\n }\r\n }\r\n ]\r\n \r\n}" }, { - "id": "95a948ed-5345-939b-280c-74f97920343e", + "id": "44de3eff-ace5-90a9-dd16-af3f5f13daad", "headers": "Authorization: Basic YWRtaW46YWRtaW4=\nContent-Type: application/json\n", - "url": "http://localhost:8181/restconf/config/ietf-interfaces:interfaces/interface/vhost1", + "url": "http://localhost:8181/restconf/config/ietf-interfaces:interfaces/interface/GigabitEthernet0%2F9%2F0/vpp-vlan:sub-interfaces/sub-interface/1/l2/rewrite", "preRequestScript": "", "pathVariables": {}, "method": "PUT", @@ -299,18 +313,18 @@ "tests": "", "currentHelper": "normal", "helperAttributes": {}, - "time": 1462891472552, - "name": "Add vhost user ifc - cfg", - "description": "Adds vhost-user interface.\nCorresponsing vpp cli command:\n\ncreate vhost-user socket /tmp/soc1 server\n\nTo verify invoke:\n\nvppctl show vhost-user\n\nor\n\nvppctl show int", - "collectionId": "61475d83-1808-fa49-7ca6-32f701e38b19", + "time": 1464805188780, + "name": "Enable tag-rewrite translate 1-2 - cfg", + "description": "Enables tag-rewrite translate 1-2 operation for GigabitEthernet0/9/0.1 sub-interface. Corresponsing vpp cli command:\n\nvppctl set interface l2 tag-rewrite GigabitEthernet0/9/0.1 translate 1-2 dot1q 111 222\n\nTo verify run:\n./build-root/install-vpp-native/vpp-api-test/bin/vpp_api_test json\nand invoke:\n\n#vat sw_interface_dump\n\nor if sub-interface was added to bridge domain:\n\nvppctl show bridge-domain [bd_id] detail", + "collectionId": "7c35192d-9085-20f6-9fcd-3f8570aaefd7", "responses": [], - "rawModeData": "{\r\n \r\n \"interface\": [\r\n {\r\n \"name\": \"vhost1\",\r\n \"description\": \"for testing purposes\",\r\n \"type\": \"v3po:vhost-user\",\r\n \"enabled\": \"true\",\r\n \"vhost-user\" : {\r\n \"socket\": \"/tmp/soc1\",\r\n \"role\": \"server\"\r\n }\r\n }\r\n ]\r\n \r\n}", - "folder": "0bca9dad-0798-f750-91ba-cc6ff8f277d5" + "folder": "37fd9569-06e3-1f08-fbcc-4b1462107a32", + "rawModeData": "{\r\n \"rewrite\": {\r\n \"vlan-type\": \"vpp-vlan:802dot1q\",\r\n \"pop-tags\": \"1\",\r\n \"push-tags\": [\r\n {\r\n \"index\": 0,\r\n \"dot1q-tag\": {\r\n \"tag-type\": \"dot1q-types:s-vlan\",\r\n \"vlan-id\": 111\r\n }\r\n },\r\n {\r\n \"index\": 1,\r\n \"dot1q-tag\": {\r\n \"tag-type\": \"dot1q-types:c-vlan\",\r\n \"vlan-id\": 222\r\n }\r\n }\r\n ]\r\n }\r\n}" }, { - "id": "4f803d8f-a351-63bd-b624-36e839ccacc3", + "id": "4db9b360-0d57-6ce6-7e3c-a6acfe17d512", "headers": "Authorization: Basic YWRtaW46YWRtaW4=\nContent-Type: application/json\n", - "url": "http://localhost:8181/restconf/config/ietf-interfaces:interfaces/interface/GigabitEthernet0%2F9%2F0/vpp-vlan:sub-interfaces/sub-interface/1", + "url": "http://localhost:8181/restconf/config/ietf-interfaces:interfaces/interface/tapp2", "preRequestScript": "", "pathVariables": {}, "method": "PUT", @@ -320,103 +334,124 @@ "tests": "", "currentHelper": "normal", "helperAttributes": {}, - "time": 1464804304987, - "name": "Add sub interface - cfg", - "description": "Adds sub interface. Corresponsing vpp cli command:\n\nvppctl create sub GigabitEthernet0/9/0 1 dot1q 100 inner-dot1q any\n\nTo verify run:\n./build-root/install-vpp-native/vpp-api-test/bin/vpp_api_test json\nand invoke:\n\n#vat sw_interface_dump", - "collectionId": "61475d83-1808-fa49-7ca6-32f701e38b19", + "time": 1462796801468, + "name": "Modify complex tap ifc - cfg", + "description": "", + "collectionId": "7c35192d-9085-20f6-9fcd-3f8570aaefd7", "responses": [], - "folder": "ba52e764-f1ec-b1cc-747f-54681ed93859", - "rawModeData": "{\r\n \"sub-interface\": [\r\n {\r\n \"identifier\": \"1\",\r\n \"vlan-type\": \"802dot1q\",\r\n \"tags\": {\r\n \"tag\": [\r\n {\r\n \"index\": \"0\",\r\n \"dot1q-tag\": {\r\n \"tag-type\": \"dot1q-types:s-vlan\",\r\n \"vlan-id\": \"100\"\r\n }\r\n },\r\n {\r\n \"index\": \"1\",\r\n \"dot1q-tag\": {\r\n \"tag-type\": \"dot1q-types:c-vlan\",\r\n \"vlan-id\": \"any\"\r\n }\r\n }\r\n ]\r\n },\r\n \"match\": {\r\n \"vlan-tagged\": {\r\n \"match-exact-tags\": \"true\"\r\n }\r\n },\r\n \"enabled\": \"false\"\r\n }\r\n ]\r\n}" + "rawModeData": "{\r\n \r\n \"interface\": [\r\n {\r\n \"name\": \"tapp2\",\r\n \"description\": \"for testing purposes\",\r\n \"type\": \"v3po:tap\",\r\n \"tap\" :{\r\n \"tap-name\" : \"tapp2\",\r\n \"mac\" : \"00:ff:ff:ff:ff:ae\",\r\n \"device-instance\" : 77\r\n }\r\n }\r\n ]\r\n \r\n}", + "folder": "60596aab-a4f1-bb64-d701-816de9482201" }, { - "id": "b638b979-fa1f-2658-cea0-934c4b809986", + "id": "4f15d0e9-8530-157e-0fe8-d24034bc31df", "headers": "Authorization: Basic YWRtaW46YWRtaW4=\nContent-Type: application/json\n", - "url": "http://localhost:8181/restconf/config/ietf-interfaces:interfaces/interface/GigabitEthernet0%2F9%2F0", + "url": "http://localhost:8181/restconf/config/ietf-interfaces:interfaces/interface/vxlanTun1", "preRequestScript": "", "pathVariables": {}, - "method": "PUT", + "method": "DELETE", "data": [], "dataMode": "raw", "version": 2, "tests": "", "currentHelper": "normal", - "helperAttributes": {}, - "time": 1464804325716, - "name": "Enable GigabitEthernet0/9/0 interface - cfg", - "description": "Enables GigabitEthernet0/9/0 interface. Equivalent vppctl command:\n\nvppctl set in state GigabitEthernet0/9/0 up\n\nNeeded to enable sub interface.\n\nTo verify invoke:\n\nvppctl show int", - "collectionId": "61475d83-1808-fa49-7ca6-32f701e38b19", + "helperAttributes": "{}", + "time": 1462892071867, + "name": "Delete virtual ifc - cfg", + "description": "", + "collectionId": "7c35192d-9085-20f6-9fcd-3f8570aaefd7", "responses": [], - "folder": "ba52e764-f1ec-b1cc-747f-54681ed93859", - "rawModeData": "{\r\n \r\n \"interface\": [\r\n {\r\n \"name\": \"GigabitEthernet0/9/0\",\r\n \"type\": \"iana-if-type:ethernetCsmacd\",\r\n \"v3po:ethernet\": {\r\n \"mtu\": 9216\r\n },\r\n \"enabled\": true,\r\n \"vpp-vlan:sub-interfaces\": {\r\n \"sub-interface\": [\r\n {\r\n \"identifier\": 1,\r\n \"vlan-type\": \"802dot1q\",\r\n \"tags\": {\r\n \"tag\": [\r\n {\r\n \"index\": 1,\r\n \"dot1q-tag\": {\r\n \"tag-type\": \"dot1q-types:c-vlan\",\r\n \"vlan-id\": \"any\"\r\n }\r\n },\r\n {\r\n \"index\": 0,\r\n \"dot1q-tag\": {\r\n \"tag-type\": \"dot1q-types:s-vlan\",\r\n \"vlan-id\": \"100\"\r\n }\r\n }\r\n ]\r\n },\r\n \"match\": {\r\n \"vlan-tagged\": {\r\n \"match-exact-tags\": true\r\n }\r\n },\r\n \"enabled\": false\r\n }\r\n ]\r\n }\r\n }\r\n ]\r\n \r\n}" + "folder": "3868e66d-0ee5-bd4d-6b35-075c4841b5c1", + "timestamp": null, + "rawModeData": "" }, { - "id": "d51282d3-2348-fcee-cbf8-ba2552034280", + "id": "55102dbd-1fc9-5f91-2082-40a2dc311f4f", "headers": "Authorization: Basic YWRtaW46YWRtaW4=\nContent-Type: application/json\n", - "url": "http://localhost:8181/restconf/config/ietf-interfaces:interfaces/interface/GigabitEthernet0%2F9%2F0/vpp-vlan:sub-interfaces/sub-interface/1", + "url": "http://localhost:8181/restconf/config/ietf-interfaces:interfaces/interface/vhost1", "preRequestScript": "", "pathVariables": {}, - "method": "PUT", + "method": "DELETE", "data": [], "dataMode": "raw", "version": 2, "tests": "", "currentHelper": "normal", - "helperAttributes": {}, - "time": 1464804333865, - "name": "Enable GigabitEthernet0/9/0.1 interface - cfg", - "description": "Enables GigabitEthernet0/9/0.1 sub interface. Equivalent vppctl command:\n\nvppctl set in state GigabitEthernet0/9/0.1 up\n\nTo enable sub interface, super interface should be enabled first.\n\nTo verify invoke:\n\nvppctl show int", - "collectionId": "61475d83-1808-fa49-7ca6-32f701e38b19", + "helperAttributes": "{}", + "time": 1462891488523, + "name": "Delete vhost user ifc - cfg", + "description": "Deletes vhost user interface.\nCorresponding vpp CLI command:\n\nvppctl delete vhost-user sw_if_index [index]\n\nTo verify invoke:\n\nvppctl show vhost-user\n\nor\n\nvppctl show int", + "collectionId": "7c35192d-9085-20f6-9fcd-3f8570aaefd7", "responses": [], - "folder": "ba52e764-f1ec-b1cc-747f-54681ed93859", - "rawModeData": "{\r\n \"sub-interface\": [\r\n {\r\n \"identifier\": \"1\",\r\n \"vlan-type\": \"802dot1q\",\r\n \"tags\": {\r\n \"tag\": [\r\n {\r\n \"index\": \"0\",\r\n \"dot1q-tag\": {\r\n \"tag-type\": \"dot1q-types:s-vlan\",\r\n \"vlan-id\": \"100\"\r\n }\r\n },\r\n {\r\n \"index\": \"1\",\r\n \"dot1q-tag\": {\r\n \"tag-type\": \"dot1q-types:c-vlan\",\r\n \"vlan-id\": \"any\"\r\n }\r\n }\r\n ]\r\n },\r\n \"match\": {\r\n \"vlan-tagged\": {\r\n \"match-exact-tags\": \"true\"\r\n }\r\n },\r\n \"enabled\": \"true\"\r\n }\r\n ]\r\n}" + "folder": "c97b9ad9-64e6-5de3-09b8-851c1189d767", + "rawModeData": "", + "descriptionFormat": null }, { - "id": "67ead758-b466-a312-2f5d-f4d3f1b18368", + "id": "5995dcf7-51c0-42ef-448b-a70bb68735d5", "headers": "Authorization: Basic YWRtaW46YWRtaW4=\nContent-Type: application/json\n", - "url": "http://localhost:8181/restconf/config/ietf-interfaces:interfaces/interface/GigabitEthernet0%2F9%2F0/vpp-vlan:sub-interfaces/sub-interface/1/l2", + "url": "http://localhost:8181/restconf/config/ietf-interfaces:interfaces/interface/tapp2", "preRequestScript": "", "pathVariables": {}, - "method": "PUT", + "method": "DELETE", "data": [], "dataMode": "raw", "version": 2, "tests": "", "currentHelper": "normal", "helperAttributes": {}, - "time": 1464813539029, - "name": "Add sub interface to bridge-domain", - "description": "Adds sub interface to bridge domain. Corresponsing vpp cli command:\n\nvppctl set interface l2 bridge GigabitEthernet0/9/0.1 1 1\n\nTo verify invoke:\nvppctl show bridge-domain 1 detail", - "collectionId": "61475d83-1808-fa49-7ca6-32f701e38b19", + "time": 1462796994090, + "name": "Delete complex tap ifc - cfg", + "description": "", + "collectionId": "7c35192d-9085-20f6-9fcd-3f8570aaefd7", "responses": [], - "folder": "ba52e764-f1ec-b1cc-747f-54681ed93859", - "rawModeData": "{\r\n \"l2\": {\r\n \"bridge-domain\": \"testBD\",\r\n \"split-horizon-group\": 1,\r\n \"bridged-virtual-interface\": \"false\"\r\n }\r\n}" + "rawModeData": "", + "folder": "60596aab-a4f1-bb64-d701-816de9482201" }, { - "id": "4a1f9526-8eb8-cc18-6993-c750a16bd4cf", + "id": "5dc1d9f4-e7ae-bb21-e558-8a56ac825922", "headers": "Authorization: Basic YWRtaW46YWRtaW4=\nContent-Type: application/json\n", - "url": "http://localhost:8181/restconf/config/ietf-interfaces:interfaces/interface/GigabitEthernet0%2F9%2F0/vpp-vlan:sub-interfaces/sub-interface/1/l2/rewrite", + "url": "http://localhost:8181/restconf/operational/v3po:vpp-state", "preRequestScript": "", "pathVariables": {}, - "method": "PUT", + "method": "GET", "data": [], "dataMode": "raw", "version": 2, "tests": "", "currentHelper": "normal", - "helperAttributes": "{}", - "time": 1464803940412, - "name": "Enable tag-rewrite push - cfg", - "description": "Enables tag-rewrite push operation for GigabitEthernet0/9/0.1 sub-interface. Corresponsing vpp cli command:\n\nvppctl set interface l2 tag-rewrite GigabitEthernet0/9/0.1 push dot1q 123 456\n\nTo verify run:\n./build-root/install-vpp-native/vpp-api-test/bin/vpp_api_test json\nand invoke:\n\n#vat sw_interface_dump\n\nor if sub-interface was added to bridge domain:\n\nvppctl show bridge-domain [bd_id] detail", - "collectionId": "61475d83-1808-fa49-7ca6-32f701e38b19", + "helperAttributes": {}, + "time": 1460539994330, + "name": "Read vpp-state - oper", + "description": "", + "collectionId": "7c35192d-9085-20f6-9fcd-3f8570aaefd7", "responses": [], - "folder": "ba52e764-f1ec-b1cc-747f-54681ed93859", - "timestamp": null, - "rawModeData": "{\r\n \"rewrite\": {\r\n \"vlan-type\": \"vpp-vlan:802dot1q\",\r\n \"push-tags\": [\r\n {\r\n \"index\": 0,\r\n \"dot1q-tag\": {\r\n \"tag-type\": \"dot1q-types:s-vlan\",\r\n \"vlan-id\": 123\r\n }\r\n },\r\n {\r\n \"index\": 1,\r\n \"dot1q-tag\": {\r\n \"tag-type\": \"dot1q-types:c-vlan\",\r\n \"vlan-id\": 456\r\n }\r\n }\r\n ]\r\n }\r\n}" + "rawModeData": "{\r\n \r\n \"interface\": [\r\n {\r\n \"name\": \"testInterface\",\r\n \"description\": \"for testing purposes\",\r\n \"type\": \"iana-if-type:ethernetCsmacd\",\r\n \"enabled\": \"true\",\r\n \"link-up-down-trap-enable\": \"enabled\",\r\n \"ietf-ip:ipv4\": {\r\n \"enabled\": \"true\",\r\n \"mtu\": \"1500\",\r\n \"address\": [\r\n {\r\n \"ip\": \"1.2.3.0\",\r\n \"netmask\": \"255.255.255.0\"\r\n }\r\n ]\r\n }\r\n }\r\n ]\r\n \r\n}" }, { - "id": "7b436781-e157-b9db-fc18-157161e9ce04", + "id": "6c5c9786-3619-ccaf-c276-0ada45711b70", "headers": "Authorization: Basic YWRtaW46YWRtaW4=\nContent-Type: application/json\n", - "url": "http://localhost:8181/restconf/config/ietf-interfaces:interfaces/interface/GigabitEthernet0%2F9%2F0/vpp-vlan:sub-interfaces/sub-interface/1/l2/rewrite", + "url": "http://localhost:8181/restconf/operational/ietf-interfaces:interfaces-state/interface/local0/ipv4", + "preRequestScript": "", + "pathVariables": {}, + "method": "GET", + "data": [], + "dataMode": "raw", + "version": 2, + "tests": "", + "currentHelper": "normal", + "helperAttributes": {}, + "time": 1465473594194, + "name": "Read local0/ipv4 - oper", + "description": "", + "collectionId": "7c35192d-9085-20f6-9fcd-3f8570aaefd7", + "responses": [], + "folder": "7a914134-23ea-3154-1557-d29dc8d464e7", + "rawModeData": "{\r\n \r\n \"interface\": [\r\n {\r\n \"name\": \"testInterface\",\r\n \"description\": \"for testing purposes\",\r\n \"type\": \"iana-if-type:ethernetCsmacd\",\r\n \"enabled\": \"true\",\r\n \"link-up-down-trap-enable\": \"enabled\",\r\n \"ietf-ip:ipv4\": {\r\n \"enabled\": \"true\",\r\n \"mtu\": \"1500\",\r\n \"address\": [\r\n {\r\n \"ip\": \"1.2.3.0\",\r\n \"netmask\": \"255.255.255.0\"\r\n }\r\n ]\r\n }\r\n }\r\n ]\r\n \r\n}" + }, + { + "id": "77383f38-941c-a136-99a6-91f9799a0b06", + "headers": "Content-Type: application/json\nAuthorization: Basic YWRtaW46YWRtaW4=\n", + "url": "http://localhost:8181/restconf/config/v3po:vpp/bridge-domains/bridge-domain/testBD", "preRequestScript": "", "pathVariables": {}, "method": "PUT", @@ -426,18 +461,17 @@ "tests": "", "currentHelper": "normal", "helperAttributes": {}, - "time": 1464805111410, - "name": "Enable tag-rewrite pop 1 - cfg", - "description": "Enables tag-rewrite pop 1 operation for GigabitEthernet0/9/0.1 sub-interface. Corresponsing vpp cli command:\n\nvppctl set interface l2 tag-rewrite GigabitEthernet0/9/0.1 pop 1\n\nTo verify run:\n./build-root/install-vpp-native/vpp-api-test/bin/vpp_api_test json\nand invoke:\n\n#vat sw_interface_dump\n\nor if sub-interface was added to bridge domain:\n\nvppctl show bridge-domain [bd_id] detail", - "collectionId": "61475d83-1808-fa49-7ca6-32f701e38b19", + "time": 1460540096743, + "name": "Add bridge domain - cfg", + "description": "", + "collectionId": "7c35192d-9085-20f6-9fcd-3f8570aaefd7", "responses": [], - "folder": "ba52e764-f1ec-b1cc-747f-54681ed93859", - "rawModeData": "{\r\n \"rewrite\": {\r\n \"pop-tags\": \"1\"\r\n }\r\n}" + "rawModeData": "{\r\n \"bridge-domain\": [\r\n {\r\n \"name\": \"testBD\",\r\n \"flood\": \"true\",\r\n \"forward\": \"false\",\r\n \"learn\": \"false\",\r\n \"unknown-unicast-flood\": \"false\",\r\n \"arp-termination\": \"false\"\r\n }\r\n ]\r\n}" }, { - "id": "698368ca-5fd3-fb7e-9e80-6030a03b15d0", + "id": "7f312f15-a81e-b513-83b7-a5f7755eae67", "headers": "Authorization: Basic YWRtaW46YWRtaW4=\nContent-Type: application/json\n", - "url": "http://localhost:8181/restconf/config/ietf-interfaces:interfaces/interface/GigabitEthernet0%2F9%2F0/vpp-vlan:sub-interfaces/sub-interface/1/l2/rewrite", + "url": "http://localhost:8181/restconf/config/ietf-interfaces:interfaces/interface/vhost1", "preRequestScript": "", "pathVariables": {}, "method": "PUT", @@ -447,39 +481,38 @@ "tests": "", "currentHelper": "normal", "helperAttributes": {}, - "time": 1464805188780, - "name": "Enable tag-rewrite translate 1-2 - cfg", - "description": "Enables tag-rewrite translate 1-2 operation for GigabitEthernet0/9/0.1 sub-interface. Corresponsing vpp cli command:\n\nvppctl set interface l2 tag-rewrite GigabitEthernet0/9/0.1 translate 1-2 dot1q 111 222\n\nTo verify run:\n./build-root/install-vpp-native/vpp-api-test/bin/vpp_api_test json\nand invoke:\n\n#vat sw_interface_dump\n\nor if sub-interface was added to bridge domain:\n\nvppctl show bridge-domain [bd_id] detail", - "collectionId": "61475d83-1808-fa49-7ca6-32f701e38b19", + "time": 1462891472552, + "name": "Add vhost user ifc - cfg", + "description": "Adds vhost-user interface.\nCorresponsing vpp cli command:\n\ncreate vhost-user socket /tmp/soc1 server\n\nTo verify invoke:\n\nvppctl show vhost-user\n\nor\n\nvppctl show int", + "collectionId": "7c35192d-9085-20f6-9fcd-3f8570aaefd7", "responses": [], - "folder": "ba52e764-f1ec-b1cc-747f-54681ed93859", - "rawModeData": "{\r\n \"rewrite\": {\r\n \"vlan-type\": \"vpp-vlan:802dot1q\",\r\n \"pop-tags\": \"1\",\r\n \"push-tags\": [\r\n {\r\n \"index\": 0,\r\n \"dot1q-tag\": {\r\n \"tag-type\": \"dot1q-types:s-vlan\",\r\n \"vlan-id\": 111\r\n }\r\n },\r\n {\r\n \"index\": 1,\r\n \"dot1q-tag\": {\r\n \"tag-type\": \"dot1q-types:c-vlan\",\r\n \"vlan-id\": 222\r\n }\r\n }\r\n ]\r\n }\r\n}" + "rawModeData": "{\r\n \r\n \"interface\": [\r\n {\r\n \"name\": \"vhost1\",\r\n \"description\": \"for testing purposes\",\r\n \"type\": \"v3po:vhost-user\",\r\n \"enabled\": \"true\",\r\n \"vhost-user\" : {\r\n \"socket\": \"/tmp/soc1\",\r\n \"role\": \"server\"\r\n }\r\n }\r\n ]\r\n \r\n}", + "folder": "c97b9ad9-64e6-5de3-09b8-851c1189d767" }, { - "id": "33083a0e-d40e-01fc-fc9f-06dda676cc97", - "headers": "Authorization: Basic YWRtaW46YWRtaW4=\nContent-Type: application/json\n", - "url": "http://localhost:8181/restconf/config/ietf-interfaces:interfaces/interface/GigabitEthernet0%2F9%2F0/vpp-vlan:sub-interfaces/sub-interface/1/l2/rewrite", + "id": "86db54f1-a60b-98d4-2639-a845d1305141", + "headers": "Content-Type: application/json\nAuthorization: Basic YWRtaW46YWRtaW4=\n", + "url": "http://localhost:8181/restconf/config/ietf-interfaces:interfaces/interface/local0", "preRequestScript": "", "pathVariables": {}, - "method": "DELETE", + "method": "PUT", "data": [], "dataMode": "raw", "version": 2, "tests": "", "currentHelper": "normal", "helperAttributes": {}, - "time": 1464804511683, - "name": "Disable tag-rewrite - cfg", - "description": "Disables tag-rewrite operation for GigabitEthernet0/9/0.1 sub-interface. Corresponsing vpp cli command:\n\nvppctl set interface l2 tag-rewrite GigabitEthernet0/9/0.1 disable\n\nTo verify run:\n./build-root/install-vpp-native/vpp-api-test/bin/vpp_api_test json\nand invoke:\n\n#vat sw_interface_dump\n\nor if sub-interface was added to bridge domain:\n\nvppctl show bridge-domain [bd_id] detail", - "collectionId": "61475d83-1808-fa49-7ca6-32f701e38b19", + "time": 1462534221488, + "name": "Add local0 to bridge domain", + "description": "Adds l2 interconnection of bridge-based type to local0 interface\n\nTo verify invoke:\n\nvppctl show bridge-domain [bd_id] detail", + "collectionId": "7c35192d-9085-20f6-9fcd-3f8570aaefd7", "responses": [], - "folder": "ba52e764-f1ec-b1cc-747f-54681ed93859", - "rawModeData": "" + "rawModeData": "{\n \"interface\": [\n {\n \"name\": \"local0\",\n \"description\": \"for testing purposes\",\n \"type\": \"iana-if-type:ethernetCsmacd\",\n \"v3po:routing\": {\n \"vrf-id\": 7\n },\n \"v3po:ethernet\": {\n \"mtu\": 64\n },\n \"enabled\": true,\n \"v3po:l2\": {\n \"bridge-domain\": \"testBD\",\n \"split-horizon-group\": \"0\",\n \"bridged-virtual-interface\": \"false\"\n }\n }\n ]\n}" }, { - "id": "a7a7c0f3-4dea-09f5-8c28-be3d7e084331", + "id": "8b339568-b60a-715f-d4fd-416bafe981a9", "headers": "Authorization: Basic YWRtaW46YWRtaW4=\nContent-Type: application/json\n", - "url": "http://localhost:8181/restconf/config/ietf-interfaces:interfaces/interface/vxlanGpeTun3", + "url": "http://localhost:8181/restconf/config/ietf-interfaces:interfaces/interface/GigabitEthernet0%2F9%2F0/vpp-vlan:sub-interfaces/sub-interface/1/l2/rewrite", "preRequestScript": "", "pathVariables": {}, "method": "PUT", @@ -488,16 +521,18 @@ "version": 2, "tests": "", "currentHelper": "normal", - "helperAttributes": {}, - "time": 1464768006369, - "name": "Add vxlan-gpe - cfg", - "description": "", - "collectionId": "61475d83-1808-fa49-7ca6-32f701e38b19", + "helperAttributes": "{}", + "time": 1464803940412, + "name": "Enable tag-rewrite push - cfg", + "description": "Enables tag-rewrite push operation for GigabitEthernet0/9/0.1 sub-interface. Corresponsing vpp cli command:\n\nvppctl set interface l2 tag-rewrite GigabitEthernet0/9/0.1 push dot1q 123 456\n\nTo verify run:\n./build-root/install-vpp-native/vpp-api-test/bin/vpp_api_test json\nand invoke:\n\n#vat sw_interface_dump\n\nor if sub-interface was added to bridge domain:\n\nvppctl show bridge-domain [bd_id] detail", + "collectionId": "7c35192d-9085-20f6-9fcd-3f8570aaefd7", "responses": [], - "rawModeData": "{\r\n \r\n \"interface\": [\r\n {\r\n \"name\": \"vxlanGpeTun3\",\r\n \"description\": \"for testing purposes\",\r\n \"type\": \"v3po:vxlan-gpe-tunnel\",\r\n \"enabled\": \"true\",\r\n \"link-up-down-trap-enable\": \"enabled\",\r\n \"routing\" : {\r\n \"vrf-id\" : \"0\"\r\n },\r\n \"vxlan-gpe\" : {\r\n \"local\" : \"192.168.50.76\",\r\n \"remote\" : \"192.168.50.71\",\r\n \"vni\" : \"9\",\r\n \"next-protocol\" : \"ethernet\",\r\n \"encap-vrf-id\" : \"0\",\r\n \"decap-vrf-id\" : \"0\"\r\n }\r\n }\r\n ]\r\n \r\n}" + "folder": "37fd9569-06e3-1f08-fbcc-4b1462107a32", + "timestamp": null, + "rawModeData": "{\r\n \"rewrite\": {\r\n \"vlan-type\": \"vpp-vlan:802dot1q\",\r\n \"push-tags\": [\r\n {\r\n \"index\": 0,\r\n \"dot1q-tag\": {\r\n \"tag-type\": \"dot1q-types:s-vlan\",\r\n \"vlan-id\": 123\r\n }\r\n },\r\n {\r\n \"index\": 1,\r\n \"dot1q-tag\": {\r\n \"tag-type\": \"dot1q-types:c-vlan\",\r\n \"vlan-id\": 456\r\n }\r\n }\r\n ]\r\n }\r\n}" }, { - "id": "bc3ade2a-51de-cb6d-f2c1-ee0598a8cb8a", + "id": "8b867c90-459f-68f6-4b2e-fa653098c28d", "headers": "Authorization: Basic YWRtaW46YWRtaW4=\nContent-Type: application/json\n", "url": "http://localhost:8181/restconf/config/ietf-interfaces:interfaces/interface/local0", "preRequestScript": "", @@ -509,55 +544,78 @@ "tests": "", "currentHelper": "normal", "helperAttributes": {}, - "time": 1460640004531, - "name": "Set vrf id for local0 - cfg", + "time": 1460540047356, + "name": "Enable local0 interface - cfg", "description": "", - "collectionId": "61475d83-1808-fa49-7ca6-32f701e38b19", + "collectionId": "7c35192d-9085-20f6-9fcd-3f8570aaefd7", "responses": [], - "rawModeData": "{\r\n \r\n \"interface\": [\r\n {\r\n \"name\": \"local0\",\r\n \"description\": \"for testing purposes only\",\r\n \"type\": \"iana-if-type:ethernetCsmacd\",\r\n \"enabled\": \"true\",\r\n \"routing\" : {\r\n \"vrf-id\" : \"7\"\r\n },\r\n \"v3po:ethernet\": {\r\n \"mtu\": 64\r\n }\r\n }\r\n ]\r\n \r\n}" + "rawModeData": "{\r\n \r\n \"interface\": [\r\n {\r\n \"name\": \"local0\",\r\n \"description\": \"for testing purposes\",\r\n \"type\": \"iana-if-type:ethernetCsmacd\",\r\n \"enabled\": \"true\",\r\n \"v3po:ethernet\": {\r\n \"mtu\": 64\r\n }\r\n }\r\n ]\r\n \r\n}" }, { - "id": "be7a6dc3-144e-be00-76e5-34395f8eb76f", - "headers": "Content-Type: application/json\nAuthorization: Basic YWRtaW46YWRtaW4=\n", - "url": "http://localhost:8181/restconf/config/v3po:vpp/bridge-domains/bridge-domain/testBD", + "id": "93022e97-24fa-5784-1e59-94674817215f", + "headers": "Authorization: Basic YWRtaW46YWRtaW4=\nContent-Type: application/json\n", + "url": "http://localhost:8181/restconf/operational/naming-context:contexts", + "pathVariables": {}, + "preRequestScript": "", + "method": "GET", + "collectionId": "7c35192d-9085-20f6-9fcd-3f8570aaefd7", + "data": [], + "dataMode": "raw", + "name": "List naming contexts - context", + "description": "List mapping context stored in context datastore", + "descriptionFormat": "html", + "time": 1463556756647, + "version": 2, + "responses": [], + "tests": "", + "currentHelper": "normal", + "helperAttributes": {}, + "rawModeData": "{\r\n \r\n \"interface\": [\r\n {\r\n \"name\": \"testInterface\",\r\n \"description\": \"for testing purposes\",\r\n \"type\": \"iana-if-type:ethernetCsmacd\",\r\n \"enabled\": \"true\",\r\n \"link-up-down-trap-enable\": \"enabled\",\r\n \"ietf-ip:ipv4\": {\r\n \"enabled\": \"true\",\r\n \"mtu\": \"1500\",\r\n \"address\": [\r\n {\r\n \"ip\": \"1.2.3.0\",\r\n \"netmask\": \"255.255.255.0\"\r\n }\r\n ]\r\n }\r\n }\r\n ]\r\n \r\n}" + }, + { + "id": "945138cf-d1f0-4674-b221-7b271010be42", + "headers": "Authorization: Basic YWRtaW46YWRtaW4=\nContent-Type: application/json\n", + "url": "http://localhost:8181/restconf/operational/ietf-interfaces:interfaces-state/interface/local0", "preRequestScript": "", "pathVariables": {}, - "method": "PUT", + "method": "GET", "data": [], "dataMode": "raw", "version": 2, "tests": "", "currentHelper": "normal", "helperAttributes": {}, - "time": 1460540096743, - "name": "Add bridge domain - cfg", + "time": 1465472429324, + "name": "Read local0 - oper", "description": "", - "collectionId": "61475d83-1808-fa49-7ca6-32f701e38b19", + "collectionId": "7c35192d-9085-20f6-9fcd-3f8570aaefd7", "responses": [], - "rawModeData": "{\r\n \"bridge-domain\": [\r\n {\r\n \"name\": \"testBD\",\r\n \"flood\": \"true\",\r\n \"forward\": \"false\",\r\n \"learn\": \"false\",\r\n \"unknown-unicast-flood\": \"false\",\r\n \"arp-termination\": \"false\"\r\n }\r\n ]\r\n}" + "folder": "7a914134-23ea-3154-1557-d29dc8d464e7", + "rawModeData": "{\r\n \r\n \"interface\": [\r\n {\r\n \"name\": \"testInterface\",\r\n \"description\": \"for testing purposes\",\r\n \"type\": \"iana-if-type:ethernetCsmacd\",\r\n \"enabled\": \"true\",\r\n \"link-up-down-trap-enable\": \"enabled\",\r\n \"ietf-ip:ipv4\": {\r\n \"enabled\": \"true\",\r\n \"mtu\": \"1500\",\r\n \"address\": [\r\n {\r\n \"ip\": \"1.2.3.0\",\r\n \"netmask\": \"255.255.255.0\"\r\n }\r\n ]\r\n }\r\n }\r\n ]\r\n \r\n}" }, { - "id": "c2b623b7-7110-3f81-1f73-482eca7bb41e", + "id": "a95120a1-5661-edc4-30cf-53afeb104440", "headers": "Authorization: Basic YWRtaW46YWRtaW4=\nContent-Type: application/json\n", - "url": "http://localhost:8181/restconf/operational/ietf-interfaces:interfaces-state/", + "url": "http://localhost:8181/restconf/config/ietf-interfaces:interfaces/interface/local0/ipv4", "preRequestScript": "", "pathVariables": {}, - "method": "GET", + "method": "PUT", "data": [], "dataMode": "raw", "version": 2, "tests": "", "currentHelper": "normal", "helperAttributes": {}, - "time": 1460539972177, - "name": "List ifcs - oper", + "time": 1465472513661, + "name": "Set ipv4 local0 interface - cfg", "description": "", - "collectionId": "61475d83-1808-fa49-7ca6-32f701e38b19", + "collectionId": "7c35192d-9085-20f6-9fcd-3f8570aaefd7", "responses": [], - "rawModeData": "{\r\n \r\n \"interface\": [\r\n {\r\n \"name\": \"testInterface\",\r\n \"description\": \"for testing purposes\",\r\n \"type\": \"iana-if-type:ethernetCsmacd\",\r\n \"enabled\": \"true\",\r\n \"link-up-down-trap-enable\": \"enabled\",\r\n \"ietf-ip:ipv4\": {\r\n \"enabled\": \"true\",\r\n \"mtu\": \"1500\",\r\n \"address\": [\r\n {\r\n \"ip\": \"1.2.3.0\",\r\n \"netmask\": \"255.255.255.0\"\r\n }\r\n ]\r\n }\r\n }\r\n ]\r\n \r\n}" + "folder": "7a914134-23ea-3154-1557-d29dc8d464e7", + "rawModeData": "{\r\n\r\n \"ipv4\" : {\r\n \"address\": [{\r\n \"ip\" : \"127.0.0.1\",\r\n \"prefix-length\" : \"24\"\r\n }]\r\n }\r\n}" }, { - "id": "d14a1086-43f2-f595-5c20-cba8b8f6a992", + "id": "ac161bec-e046-4bb7-d695-60bdfb0c6cea", "headers": "Authorization: Basic YWRtaW46YWRtaW4=\nContent-Type: application/json\n", "url": "http://localhost:8181/restconf/config/ietf-interfaces:interfaces/interface/vhost1", "preRequestScript": "", @@ -572,15 +630,15 @@ "time": 1462891483790, "name": "Modify vhost user ifc - cfg", "description": "Modifies vhost-user interface socket.\nTo verify invoke:\n\nvppctl show vhost-user", - "collectionId": "61475d83-1808-fa49-7ca6-32f701e38b19", + "collectionId": "7c35192d-9085-20f6-9fcd-3f8570aaefd7", "responses": [], "rawModeData": "{\r\n \r\n \"interface\": [\r\n {\r\n \"name\": \"vhost1\",\r\n \"description\": \"for testing purposes\",\r\n \"type\": \"v3po:vhost-user\",\r\n \"enabled\": \"true\",\r\n \"vhost-user\" : {\r\n \"socket\": \"/tmp/soc2\",\r\n \"role\": \"server\"\r\n }\r\n }\r\n ]\r\n \r\n}", - "folder": "0bca9dad-0798-f750-91ba-cc6ff8f277d5" + "folder": "c97b9ad9-64e6-5de3-09b8-851c1189d767" }, { - "id": "d46e1911-cf84-3805-a085-2219a49a7557", + "id": "b08a0677-6b59-74ea-e5c6-7383194b19dd", "headers": "Authorization: Basic YWRtaW46YWRtaW4=\nContent-Type: application/json\n", - "url": "http://localhost:8181/restconf/config/ietf-interfaces:interfaces/interface/tapp2", + "url": "http://localhost:8181/restconf/config/ietf-interfaces:interfaces/interface/GigabitEthernet0%2F9%2F0/vpp-vlan:sub-interfaces/sub-interface/1/l2/rewrite", "preRequestScript": "", "pathVariables": {}, "method": "DELETE", @@ -590,60 +648,60 @@ "tests": "", "currentHelper": "normal", "helperAttributes": {}, - "time": 1462796994090, - "name": "Delete complex tap ifc - cfg", - "description": "", - "collectionId": "61475d83-1808-fa49-7ca6-32f701e38b19", + "time": 1464804511683, + "name": "Disable tag-rewrite - cfg", + "description": "Disables tag-rewrite operation for GigabitEthernet0/9/0.1 sub-interface. Corresponsing vpp cli command:\n\nvppctl set interface l2 tag-rewrite GigabitEthernet0/9/0.1 disable\n\nTo verify run:\n./build-root/install-vpp-native/vpp-api-test/bin/vpp_api_test json\nand invoke:\n\n#vat sw_interface_dump\n\nor if sub-interface was added to bridge domain:\n\nvppctl show bridge-domain [bd_id] detail", + "collectionId": "7c35192d-9085-20f6-9fcd-3f8570aaefd7", "responses": [], - "rawModeData": "", - "folder": "4ff8ebe4-bd44-681a-7093-9422424099b1" + "folder": "37fd9569-06e3-1f08-fbcc-4b1462107a32", + "rawModeData": "" }, { - "id": "eeeb8b70-d222-6d9a-6521-1e16bf8db401", + "id": "bd2897c6-5fc7-bec5-87be-4fd52bb8e471", "headers": "Authorization: Basic YWRtaW46YWRtaW4=\nContent-Type: application/json\n", - "url": "http://localhost:8181/restconf/operational/v3po:vpp-state", + "url": "http://localhost:8181/restconf/config/ietf-interfaces:interfaces/interface/GigabitEthernet0%2F9%2F0/vpp-vlan:sub-interfaces/sub-interface/1/l2/rewrite", "preRequestScript": "", "pathVariables": {}, - "method": "GET", + "method": "PUT", "data": [], "dataMode": "raw", "version": 2, "tests": "", "currentHelper": "normal", "helperAttributes": {}, - "time": 1460539994330, - "name": "Read vpp-state - oper", - "description": "", - "collectionId": "61475d83-1808-fa49-7ca6-32f701e38b19", + "time": 1464805111410, + "name": "Enable tag-rewrite pop 1 - cfg", + "description": "Enables tag-rewrite pop 1 operation for GigabitEthernet0/9/0.1 sub-interface. Corresponsing vpp cli command:\n\nvppctl set interface l2 tag-rewrite GigabitEthernet0/9/0.1 pop 1\n\nTo verify run:\n./build-root/install-vpp-native/vpp-api-test/bin/vpp_api_test json\nand invoke:\n\n#vat sw_interface_dump\n\nor if sub-interface was added to bridge domain:\n\nvppctl show bridge-domain [bd_id] detail", + "collectionId": "7c35192d-9085-20f6-9fcd-3f8570aaefd7", "responses": [], - "rawModeData": "{\r\n \r\n \"interface\": [\r\n {\r\n \"name\": \"testInterface\",\r\n \"description\": \"for testing purposes\",\r\n \"type\": \"iana-if-type:ethernetCsmacd\",\r\n \"enabled\": \"true\",\r\n \"link-up-down-trap-enable\": \"enabled\",\r\n \"ietf-ip:ipv4\": {\r\n \"enabled\": \"true\",\r\n \"mtu\": \"1500\",\r\n \"address\": [\r\n {\r\n \"ip\": \"1.2.3.0\",\r\n \"netmask\": \"255.255.255.0\"\r\n }\r\n ]\r\n }\r\n }\r\n ]\r\n \r\n}" + "folder": "37fd9569-06e3-1f08-fbcc-4b1462107a32", + "rawModeData": "{\r\n \"rewrite\": {\r\n \"pop-tags\": \"1\"\r\n }\r\n}" }, { - "id": "f0faabc8-eab8-bb4d-1042-b45716ecb155", + "id": "cbb77318-52e0-5647-cd1c-8c679ea7b830", "headers": "Authorization: Basic YWRtaW46YWRtaW4=\nContent-Type: application/json\n", - "url": "http://localhost:8181/restconf/config/ietf-interfaces:interfaces/interface/vxlanTun1", + "url": "http://localhost:8181/restconf/config/ietf-interfaces:interfaces/interface/GigabitEthernet0%2F9%2F0/vpp-vlan:sub-interfaces/sub-interface/1/l2", "preRequestScript": "", "pathVariables": {}, - "method": "DELETE", + "method": "PUT", "data": [], "dataMode": "raw", "version": 2, "tests": "", "currentHelper": "normal", - "helperAttributes": "{}", - "time": 1462892071867, - "name": "Delete virtual ifc - cfg", - "description": "", - "collectionId": "61475d83-1808-fa49-7ca6-32f701e38b19", + "helperAttributes": {}, + "time": 1464813539029, + "name": "Add sub interface to bridge-domain", + "description": "Adds sub interface to bridge domain. Corresponsing vpp cli command:\n\nvppctl set interface l2 bridge GigabitEthernet0/9/0.1 1 1\n\nTo verify invoke:\nvppctl show bridge-domain 1 detail", + "collectionId": "7c35192d-9085-20f6-9fcd-3f8570aaefd7", "responses": [], - "folder": "f8061658-c931-5f3c-c119-857c8b1508b1", - "timestamp": null, - "rawModeData": "" + "folder": "37fd9569-06e3-1f08-fbcc-4b1462107a32", + "rawModeData": "{\r\n \"l2\": {\r\n \"bridge-domain\": \"testBD\",\r\n \"split-horizon-group\": 1,\r\n \"bridged-virtual-interface\": \"false\"\r\n }\r\n}" }, { - "id": "f19bf50c-b847-a7a0-cabe-31b2cf23b745", + "id": "d27322b8-59d5-a2dc-a7a2-8f7197057164", "headers": "Authorization: Basic YWRtaW46YWRtaW4=\nContent-Type: application/json\n", - "url": "http://localhost:8181/restconf/config/v3po:vpp", + "url": "http://localhost:8181/restconf/operational/ietf-interfaces:interfaces-state/", "preRequestScript": "", "pathVariables": {}, "method": "GET", @@ -653,33 +711,74 @@ "tests": "", "currentHelper": "normal", "helperAttributes": {}, - "time": 1460540006597, - "name": "Read vpp - cfg", + "time": 1460539972177, + "name": "List ifcs - oper", "description": "", - "collectionId": "61475d83-1808-fa49-7ca6-32f701e38b19", + "collectionId": "7c35192d-9085-20f6-9fcd-3f8570aaefd7", "responses": [], "rawModeData": "{\r\n \r\n \"interface\": [\r\n {\r\n \"name\": \"testInterface\",\r\n \"description\": \"for testing purposes\",\r\n \"type\": \"iana-if-type:ethernetCsmacd\",\r\n \"enabled\": \"true\",\r\n \"link-up-down-trap-enable\": \"enabled\",\r\n \"ietf-ip:ipv4\": {\r\n \"enabled\": \"true\",\r\n \"mtu\": \"1500\",\r\n \"address\": [\r\n {\r\n \"ip\": \"1.2.3.0\",\r\n \"netmask\": \"255.255.255.0\"\r\n }\r\n ]\r\n }\r\n }\r\n ]\r\n \r\n}" }, { - "id": "fce0239b-0d55-5578-e216-51a7a0f57cc4", + "id": "e611d23a-c205-192b-e8f9-dd99fa169274", "headers": "Authorization: Basic YWRtaW46YWRtaW4=\nContent-Type: application/json\n", - "url": "http://localhost:8181/restconf/operational/naming-context:contexts", + "url": "http://localhost:8181/restconf/config/ietf-interfaces:interfaces", + "preRequestScript": "", "pathVariables": {}, + "method": "PUT", + "data": [], + "dataMode": "raw", + "version": 2, + "tests": "", + "currentHelper": "normal", + "helperAttributes": {}, + "time": 1460636113690, + "name": "Set interfaces bulk edit - cfg", + "description": "", + "collectionId": "7c35192d-9085-20f6-9fcd-3f8570aaefd7", + "responses": [], + "rawModeData": "{\n \"interfaces\": {\n \"interface\": [\n {\n \"name\": \"pg/stream-2\",\n \"enabled\": true,\n \"type\": \"iana-if-type:ethernetCsmacd\"\n },\n {\n \"name\": \"pg/stream-3\",\n \"enabled\": true,\n \"type\": \"iana-if-type:ethernetCsmacd\"\n },\n {\n \"name\": \"pg/stream-0\",\n \"enabled\": true,\n \"type\": \"iana-if-type:ethernetCsmacd\"\n },\n {\n \"name\": \"local0\",\n \"description\": \"for testing purposes\",\n \"type\": \"iana-if-type:ethernetCsmacd\",\n \"enabled\": true\n },\n {\n \"name\": \"pg/stream-1\",\n \"enabled\": true,\n \"type\": \"iana-if-type:ethernetCsmacd\"\n }\n ]\n }\n}" + }, + { + "id": "f014ab21-8e40-c344-a68b-0f1b86578bd8", + "headers": "Authorization: Basic YWRtaW46YWRtaW4=\nContent-Type: application/json\n", + "url": "http://localhost:8181/restconf/config/ietf-interfaces:interfaces/interface/vxlanTun1", "preRequestScript": "", - "method": "GET", - "collectionId": "61475d83-1808-fa49-7ca6-32f701e38b19", + "pathVariables": {}, + "method": "PUT", "data": [], "dataMode": "raw", - "name": "List naming contexts - context", - "description": "List mapping context stored in context datastore", - "descriptionFormat": "html", - "time": 1463556756647, "version": 2, + "tests": "", + "currentHelper": "normal", + "helperAttributes": {}, + "time": 1464767860505, + "name": "Add virtual ifc - cfg", + "description": "", + "collectionId": "7c35192d-9085-20f6-9fcd-3f8570aaefd7", "responses": [], + "rawModeData": "{\r\n \r\n \"interface\": [\r\n {\r\n \"name\": \"vxlanTun1\",\r\n \"description\": \"for testing purposes\",\r\n \"type\": \"v3po:vxlan-tunnel\",\r\n \"enabled\": \"true\",\r\n \"link-up-down-trap-enable\": \"enabled\",\r\n \"routing\" : {\r\n \"vrf-id\" : \"0\"\r\n },\r\n \"vxlan\" : {\r\n \"src\" : \"192.168.1.6\",\r\n \"dst\" : \"192.168.1.9\",\r\n \"vni\" : \"88\",\r\n \"encap-vrf-id\" : \"0\"\r\n }\r\n }\r\n ]\r\n \r\n}", + "folder": "3868e66d-0ee5-bd4d-6b35-075c4841b5c1" + }, + { + "id": "f2e9a3cb-f3cc-f501-6015-8ebf7d8b2c3e", + "headers": "Authorization: Basic YWRtaW46YWRtaW4=\nContent-Type: application/json\n", + "url": "http://localhost:8181/restconf/config/ietf-interfaces:interfaces/interface/GigabitEthernet0%2F9%2F0/vpp-vlan:sub-interfaces/sub-interface/1", + "preRequestScript": "", + "pathVariables": {}, + "method": "PUT", + "data": [], + "dataMode": "raw", + "version": 2, "tests": "", "currentHelper": "normal", "helperAttributes": {}, - "rawModeData": "{\r\n \r\n \"interface\": [\r\n {\r\n \"name\": \"testInterface\",\r\n \"description\": \"for testing purposes\",\r\n \"type\": \"iana-if-type:ethernetCsmacd\",\r\n \"enabled\": \"true\",\r\n \"link-up-down-trap-enable\": \"enabled\",\r\n \"ietf-ip:ipv4\": {\r\n \"enabled\": \"true\",\r\n \"mtu\": \"1500\",\r\n \"address\": [\r\n {\r\n \"ip\": \"1.2.3.0\",\r\n \"netmask\": \"255.255.255.0\"\r\n }\r\n ]\r\n }\r\n }\r\n ]\r\n \r\n}" + "time": 1464804333865, + "name": "Enable GigabitEthernet0/9/0.1 interface - cfg", + "description": "Enables GigabitEthernet0/9/0.1 sub interface. Equivalent vppctl command:\n\nvppctl set in state GigabitEthernet0/9/0.1 up\n\nTo enable sub interface, super interface should be enabled first.\n\nTo verify invoke:\n\nvppctl show int", + "collectionId": "7c35192d-9085-20f6-9fcd-3f8570aaefd7", + "responses": [], + "folder": "37fd9569-06e3-1f08-fbcc-4b1462107a32", + "rawModeData": "{\r\n \"sub-interface\": [\r\n {\r\n \"identifier\": \"1\",\r\n \"vlan-type\": \"802dot1q\",\r\n \"tags\": {\r\n \"tag\": [\r\n {\r\n \"index\": \"0\",\r\n \"dot1q-tag\": {\r\n \"tag-type\": \"dot1q-types:s-vlan\",\r\n \"vlan-id\": \"100\"\r\n }\r\n },\r\n {\r\n \"index\": \"1\",\r\n \"dot1q-tag\": {\r\n \"tag-type\": \"dot1q-types:c-vlan\",\r\n \"vlan-id\": \"any\"\r\n }\r\n }\r\n ]\r\n },\r\n \"match\": {\r\n \"vlan-tagged\": {\r\n \"match-exact-tags\": \"true\"\r\n }\r\n },\r\n \"enabled\": \"true\"\r\n }\r\n ]\r\n}" } ] }
\ No newline at end of file diff --git a/v3po/translate-impl/src/main/java/io/fd/honeycomb/v3po/translate/impl/read/AbstractCompositeReader.java b/v3po/translate-impl/src/main/java/io/fd/honeycomb/v3po/translate/impl/read/AbstractCompositeReader.java index f026d4f92..afd979167 100644 --- a/v3po/translate-impl/src/main/java/io/fd/honeycomb/v3po/translate/impl/read/AbstractCompositeReader.java +++ b/v3po/translate-impl/src/main/java/io/fd/honeycomb/v3po/translate/impl/read/AbstractCompositeReader.java @@ -141,10 +141,14 @@ abstract class AbstractCompositeReader<D extends DataObject, B extends Builder<D LOG.debug("{}: Reading subtree: {}", this, id); final Class<? extends DataObject> next = RWUtils.getNextId(id, getManagedDataObjectType()).getType(); final ChildReader<? extends ChildOf<D>> reader = childReaders.get(next); + final ChildReader<? extends Augmentation<D>> augReader = augReaders.get(next); if (reader != null) { LOG.debug("{}: Reading subtree: {} from: {}", this, id, reader); return reader.read(id, ctx); + }if (augReader != null) { + LOG.debug("{}: Reading subtree: {} from: {}", this, id, augReader); + return augReader.read(id, ctx); } else { LOG.debug("{}: Dedicated subtree reader missing for: {}. Reading current and filtering", this, next); // If there's no dedicated reader, use read current diff --git a/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/v3po/translate/v3po/initializers/InterfacesInitializer.java b/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/v3po/translate/v3po/initializers/InterfacesInitializer.java index 5a0e35dbd..23898689f 100644 --- a/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/v3po/translate/v3po/initializers/InterfacesInitializer.java +++ b/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/v3po/translate/v3po/initializers/InterfacesInitializer.java @@ -18,8 +18,11 @@ package io.fd.honeycomb.v3po.translate.v3po.initializers; import static io.fd.honeycomb.v3po.translate.v3po.initializers.SubInterfaceInitializationUtils.initializeSubinterfaceStateAugmentation; +import com.google.common.base.Preconditions; import com.google.common.collect.Lists; import io.fd.honeycomb.v3po.vpp.data.init.AbstractDataTreeConverter; +import java.util.List; +import java.util.stream.Collectors; import javax.annotation.Nonnull; import org.opendaylight.controller.md.sal.binding.api.DataBroker; import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.Interfaces; @@ -29,11 +32,19 @@ import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces. import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.InterfaceBuilder; import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.InterfaceKey; import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.state.Interface.AdminStatus; +import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.ip.rev140616.Interface1; +import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.ip.rev140616.Interface1Builder; +import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.ip.rev140616.Interface2; +import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.ip.rev140616.interfaces._interface.Ipv4Builder; +import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.ip.rev140616.interfaces._interface.ipv4.address.Subnet; +import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.ip.rev140616.interfaces._interface.ipv4.address.subnet.PrefixLengthBuilder; +import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.ip.rev140616.interfaces.state._interface.Ipv4; +import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.ip.rev140616.interfaces.state._interface.ipv4.Address; import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev150105.VppInterfaceAugmentation; import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev150105.VppInterfaceAugmentationBuilder; import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev150105.VppInterfaceStateAugmentation; -import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev150105.VxlanVni; import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev150105.VxlanGpeVni; +import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev150105.VxlanVni; import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev150105.interfaces._interface.EthernetBuilder; import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev150105.interfaces._interface.L2Builder; import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev150105.interfaces._interface.TapBuilder; @@ -91,6 +102,7 @@ public class InterfacesInitializer extends AbstractDataTreeConverter<InterfacesS initializeVppInterfaceStateAugmentation(input, builder); initializeSubinterfaceStateAugmentation(input, builder); + initializeIetfIpAugmentation(input, builder); return builder.build(); } @@ -140,6 +152,44 @@ public class InterfacesInitializer extends AbstractDataTreeConverter<InterfacesS } } + private static void initializeIetfIpAugmentation( + final org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.state.Interface input, + final InterfaceBuilder builder) { + final Interface2 ietfIpAugmentation = input.getAugmentation(Interface2.class); + if(ietfIpAugmentation != null) { + final Interface1Builder augmentBuilder = new Interface1Builder(); + + final Ipv4 ipv4 = ietfIpAugmentation.getIpv4(); + if(ipv4 != null) { + final List<org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.ip.rev140616.interfaces._interface.ipv4.Address> collect = + ipv4.getAddress().stream() + .map(address -> new org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.ip.rev140616.interfaces._interface.ipv4.AddressBuilder() + .setIp(address.getIp()) + .setSubnet(getSubnet(address)) + .build()) + .collect(Collectors.toList()); + augmentBuilder.setIpv4(new Ipv4Builder().setAddress(collect).build()); + } + + // TODO ipv6 + + builder.addAugmentation(Interface1.class, augmentBuilder.build()); + } + } + + private static Subnet getSubnet(final Address address) { + final org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.ip.rev140616.interfaces.state._interface.ipv4.address.Subnet + subnet = address.getSubnet(); + + // TODO only prefix length supported + Preconditions.checkArgument( + subnet instanceof org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.ip.rev140616.interfaces.state._interface.ipv4.address.subnet.PrefixLength); + + return new PrefixLengthBuilder().setPrefixLength( + ((org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.ip.rev140616.interfaces.state._interface.ipv4.address.subnet.PrefixLength) subnet) + .getPrefixLength()).build(); + } + private static void setEthernet(final VppInterfaceAugmentationBuilder augmentBuilder, final Ethernet ethernet) { final EthernetBuilder ethernetBuilder = new EthernetBuilder(); ethernetBuilder.setMtu(ethernet.getMtu()); diff --git a/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/v3po/translate/v3po/interfaces/ip/Ipv4Customizer.java b/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/v3po/translate/v3po/interfaces/ip/Ipv4Customizer.java index 5e00dd9b3..f322e9d2c 100644 --- a/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/v3po/translate/v3po/interfaces/ip/Ipv4Customizer.java +++ b/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/v3po/translate/v3po/interfaces/ip/Ipv4Customizer.java @@ -16,6 +16,9 @@ package io.fd.honeycomb.v3po.translate.v3po.interfaces.ip; +import static com.google.common.base.Preconditions.checkArgument; +import static com.google.common.base.Preconditions.checkNotNull; + import com.google.common.base.Optional; import io.fd.honeycomb.v3po.translate.spi.write.ChildWriterCustomizer; import io.fd.honeycomb.v3po.translate.v3po.util.FutureJVppCustomizer; @@ -23,6 +26,8 @@ import io.fd.honeycomb.v3po.translate.v3po.util.NamingContext; import io.fd.honeycomb.v3po.translate.v3po.util.TranslateUtils; import io.fd.honeycomb.v3po.translate.write.WriteContext; import io.fd.honeycomb.v3po.translate.write.WriteFailedException; +import java.util.concurrent.CompletionStage; +import javax.annotation.Nonnull; import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.Interface; import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.ip.rev140616.Interface1; import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.ip.rev140616.interfaces._interface.Ipv4; @@ -39,12 +44,6 @@ import org.openvpp.jvpp.future.FutureJVpp; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import javax.annotation.Nonnull; -import java.util.concurrent.CompletionStage; - -import static com.google.common.base.Preconditions.checkArgument; -import static com.google.common.base.Preconditions.checkNotNull; - public class Ipv4Customizer extends FutureJVppCustomizer implements ChildWriterCustomizer<Ipv4> { private static final Logger LOG = LoggerFactory.getLogger(Ipv4Customizer.class); @@ -93,6 +92,11 @@ public class Ipv4Customizer extends FutureJVppCustomizer implements ChildWriterC throws WriteFailedException { final int swIfc = interfaceContext.getIndex(name, writeContext.getMappingContext()); + // TODO what about other children ? + // TODO consider dedicated customizer for complex child nodes like address list + + // TODO this is not behaving correctly, this always adds IP even if the entire address list was overwritten + // Using child customizers according to YANG structure should help for (Address ipv4Addr : ipv4.getAddress()) { Subnet subnet = ipv4Addr.getSubnet(); diff --git a/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/v3po/translate/v3po/interfacesstate/InterfaceUtils.java b/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/v3po/translate/v3po/interfacesstate/InterfaceUtils.java index f262df90f..24a1b4ab5 100644 --- a/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/v3po/translate/v3po/interfacesstate/InterfaceUtils.java +++ b/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/v3po/translate/v3po/interfacesstate/InterfaceUtils.java @@ -16,7 +16,6 @@ package io.fd.honeycomb.v3po.translate.v3po.interfacesstate; -import static com.google.common.base.Preconditions.checkNotNull; import static io.fd.honeycomb.v3po.translate.v3po.interfacesstate.InterfaceCustomizer.getCachedInterfaceDump; import static java.util.Objects.requireNonNull; @@ -34,6 +33,7 @@ import java.util.stream.Collectors; import javax.annotation.Nonnull; import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.iana._if.type.rev140508.EthernetCsmacd; import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.InterfaceType; +import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.state.Interface; import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.Gauge64; import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev150105.Tap; import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev150105.VhostUser; @@ -248,12 +248,21 @@ public final class InterfaceUtils { return EthernetCsmacd.class; } - static boolean isInterfaceOfType(final ModificationCache ctx, final int index, - final Class<? extends InterfaceType> ifcType) { - final SwInterfaceDetails cachedDetails = - checkNotNull(getCachedInterfaceDump(ctx).get(index), - "Interface {} cannot be found in context", index); - return isInterfaceOfType(ifcType, cachedDetails); + /** + * Check interface type. Uses interface details from VPP to determine. + * Uses {@link #getVppInterfaceDetails(FutureJVpp, InstanceIdentifier, String, int, ModificationCache)} internally + * so tries to utilize cache before asking VPP. + */ + static boolean isInterfaceOfType(@Nonnull final FutureJVpp jvpp, + @Nonnull final ModificationCache cache, + @Nonnull final InstanceIdentifier<?> id, + final int index, + @Nonnull final Class<? extends InterfaceType> ifcType) throws ReadFailedException { + final String name = id.firstKeyOf(Interface.class).getName(); + final SwInterfaceDetails vppInterfaceDetails = + getVppInterfaceDetails(jvpp, id, name, index, cache); + + return isInterfaceOfType(ifcType, vppInterfaceDetails); } static boolean isInterfaceOfType(final Class<? extends InterfaceType> ifcType, diff --git a/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/v3po/translate/v3po/interfacesstate/TapCustomizer.java b/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/v3po/translate/v3po/interfacesstate/TapCustomizer.java index 44256956c..a206f2559 100644 --- a/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/v3po/translate/v3po/interfacesstate/TapCustomizer.java +++ b/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/v3po/translate/v3po/interfacesstate/TapCustomizer.java @@ -16,12 +16,20 @@ package io.fd.honeycomb.v3po.translate.v3po.interfacesstate; +import static io.fd.honeycomb.v3po.translate.v3po.interfacesstate.InterfaceUtils.isInterfaceOfType; + import io.fd.honeycomb.v3po.translate.read.ReadContext; import io.fd.honeycomb.v3po.translate.read.ReadFailedException; import io.fd.honeycomb.v3po.translate.spi.read.ChildReaderCustomizer; import io.fd.honeycomb.v3po.translate.v3po.util.FutureJVppCustomizer; import io.fd.honeycomb.v3po.translate.v3po.util.NamingContext; import io.fd.honeycomb.v3po.translate.v3po.util.TranslateUtils; +import java.util.Collections; +import java.util.List; +import java.util.Map; +import java.util.concurrent.CompletionStage; +import java.util.stream.Collectors; +import javax.annotation.Nonnull; import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.state.Interface; import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.state.InterfaceKey; import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev150105.VppInterfaceStateAugmentationBuilder; @@ -38,15 +46,6 @@ import org.openvpp.jvpp.future.FutureJVpp; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import javax.annotation.Nonnull; -import java.util.Collections; -import java.util.List; -import java.util.Map; -import java.util.concurrent.CompletionStage; -import java.util.stream.Collectors; - -import static io.fd.honeycomb.v3po.translate.v3po.interfacesstate.InterfaceUtils.isInterfaceOfType; - public class TapCustomizer extends FutureJVppCustomizer implements ChildReaderCustomizer<Tap, TapBuilder> { @@ -77,10 +76,9 @@ public class TapCustomizer extends FutureJVppCustomizer @Nonnull final ReadContext ctx) throws ReadFailedException { try { final InterfaceKey key = id.firstKeyOf(Interface.class); - // Relying here that parent InterfaceCustomizer was invoked first (PREORDER) - // to fill in the context with initial ifc mapping final int index = interfaceContext.getIndex(key.getName(), ctx.getMappingContext()); - if (!isInterfaceOfType(ctx.getModificationCache(), index, org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev150105.Tap.class)) { + if (!isInterfaceOfType(getFutureJVpp(), ctx.getModificationCache(), id, index, + org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev150105.Tap.class)) { return; } diff --git a/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/v3po/translate/v3po/interfacesstate/VhostUserCustomizer.java b/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/v3po/translate/v3po/interfacesstate/VhostUserCustomizer.java index 7085392f6..8023bb1df 100644 --- a/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/v3po/translate/v3po/interfacesstate/VhostUserCustomizer.java +++ b/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/v3po/translate/v3po/interfacesstate/VhostUserCustomizer.java @@ -16,12 +16,21 @@ package io.fd.honeycomb.v3po.translate.v3po.interfacesstate; +import static io.fd.honeycomb.v3po.translate.v3po.interfacesstate.InterfaceUtils.isInterfaceOfType; + import io.fd.honeycomb.v3po.translate.read.ReadContext; import io.fd.honeycomb.v3po.translate.read.ReadFailedException; import io.fd.honeycomb.v3po.translate.spi.read.ChildReaderCustomizer; import io.fd.honeycomb.v3po.translate.v3po.util.FutureJVppCustomizer; import io.fd.honeycomb.v3po.translate.v3po.util.NamingContext; import io.fd.honeycomb.v3po.translate.v3po.util.TranslateUtils; +import java.math.BigInteger; +import java.util.Collections; +import java.util.List; +import java.util.Map; +import java.util.concurrent.CompletionStage; +import java.util.stream.Collectors; +import javax.annotation.Nonnull; import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.state.Interface; import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.state.InterfaceKey; import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev150105.VhostUserRole; @@ -39,16 +48,6 @@ import org.openvpp.jvpp.future.FutureJVpp; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import javax.annotation.Nonnull; -import java.math.BigInteger; -import java.util.Collections; -import java.util.List; -import java.util.Map; -import java.util.concurrent.CompletionStage; -import java.util.stream.Collectors; - -import static io.fd.honeycomb.v3po.translate.v3po.interfacesstate.InterfaceUtils.isInterfaceOfType; - public class VhostUserCustomizer extends FutureJVppCustomizer implements ChildReaderCustomizer<VhostUser, VhostUserBuilder> { @@ -79,10 +78,9 @@ public class VhostUserCustomizer extends FutureJVppCustomizer @Nonnull final ReadContext ctx) throws ReadFailedException { try { final InterfaceKey key = id.firstKeyOf(Interface.class); - // Relying here that parent InterfaceCustomizer was invoked first (PREORDER) - // to fill in the context with initial ifc mapping final int index = interfaceContext.getIndex(key.getName(), ctx.getMappingContext()); - if (!isInterfaceOfType(ctx.getModificationCache(), index, org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev150105.VhostUser.class)) { + if (!isInterfaceOfType(getFutureJVpp(), ctx.getModificationCache(), id, index, + org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev150105.VhostUser.class)) { return; } diff --git a/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/v3po/translate/v3po/interfacesstate/VxlanCustomizer.java b/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/v3po/translate/v3po/interfacesstate/VxlanCustomizer.java index 41f4b6edc..c1068d0ea 100644 --- a/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/v3po/translate/v3po/interfacesstate/VxlanCustomizer.java +++ b/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/v3po/translate/v3po/interfacesstate/VxlanCustomizer.java @@ -16,12 +16,20 @@ package io.fd.honeycomb.v3po.translate.v3po.interfacesstate; +import static com.google.common.base.Preconditions.checkState; +import static io.fd.honeycomb.v3po.translate.v3po.interfacesstate.InterfaceUtils.isInterfaceOfType; + import io.fd.honeycomb.v3po.translate.read.ReadContext; import io.fd.honeycomb.v3po.translate.read.ReadFailedException; import io.fd.honeycomb.v3po.translate.spi.read.ChildReaderCustomizer; import io.fd.honeycomb.v3po.translate.v3po.util.FutureJVppCustomizer; import io.fd.honeycomb.v3po.translate.v3po.util.NamingContext; import io.fd.honeycomb.v3po.translate.v3po.util.TranslateUtils; +import java.net.InetAddress; +import java.net.UnknownHostException; +import java.util.Arrays; +import java.util.concurrent.CompletionStage; +import javax.annotation.Nonnull; import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpAddress; import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv4Address; import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv6Address; @@ -43,14 +51,6 @@ import org.openvpp.jvpp.future.FutureJVpp; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import javax.annotation.Nonnull; -import java.net.InetAddress; -import java.net.UnknownHostException; -import java.util.Arrays; -import java.util.concurrent.CompletionStage; - -import static com.google.common.base.Preconditions.checkState; - public class VxlanCustomizer extends FutureJVppCustomizer implements ChildReaderCustomizer<Vxlan, VxlanBuilder> { @@ -80,10 +80,8 @@ public class VxlanCustomizer extends FutureJVppCustomizer @Nonnull final ReadContext ctx) throws ReadFailedException { try { final InterfaceKey key = id.firstKeyOf(Interface.class); - // Relying here that parent InterfaceCustomizer was invoked first (PREORDER) - // to fill in the context with initial ifc mapping final int index = interfaceContext.getIndex(key.getName(), ctx.getMappingContext()); - if (!InterfaceUtils.isInterfaceOfType(ctx.getModificationCache(), index, VxlanTunnel.class)) { + if (!isInterfaceOfType(getFutureJVpp(), ctx.getModificationCache(), id, index, VxlanTunnel.class)) { return; } diff --git a/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/v3po/translate/v3po/interfacesstate/VxlanGpeCustomizer.java b/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/v3po/translate/v3po/interfacesstate/VxlanGpeCustomizer.java index d364eca1a..c5c04e113 100644 --- a/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/v3po/translate/v3po/interfacesstate/VxlanGpeCustomizer.java +++ b/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/v3po/translate/v3po/interfacesstate/VxlanGpeCustomizer.java @@ -17,6 +17,7 @@ package io.fd.honeycomb.v3po.translate.v3po.interfacesstate; import static com.google.common.base.Preconditions.checkState; +import static io.fd.honeycomb.v3po.translate.v3po.interfacesstate.InterfaceUtils.isInterfaceOfType; import io.fd.honeycomb.v3po.translate.read.ReadContext; import io.fd.honeycomb.v3po.translate.read.ReadFailedException; @@ -35,17 +36,15 @@ import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types. import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.state.Interface; import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.state.InterfaceKey; import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev150105.VppInterfaceStateAugmentationBuilder; +import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev150105.VxlanGpeNextProtocol; import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev150105.VxlanGpeTunnel; import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev150105.VxlanGpeVni; -import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev150105.VxlanGpeNextProtocol; import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev150105.interfaces.state._interface.VxlanGpe; import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev150105.interfaces.state._interface.VxlanGpeBuilder; import org.opendaylight.yangtools.concepts.Builder; import org.opendaylight.yangtools.yang.binding.DataObject; import org.opendaylight.yangtools.yang.binding.InstanceIdentifier; import org.openvpp.jvpp.VppBaseCallException; -import org.openvpp.jvpp.VppCallbackException; -import org.openvpp.jvpp.VppInvocationException; import org.openvpp.jvpp.dto.VxlanGpeTunnelDetails; import org.openvpp.jvpp.dto.VxlanGpeTunnelDetailsReplyDump; import org.openvpp.jvpp.dto.VxlanGpeTunnelDump; @@ -82,10 +81,8 @@ public class VxlanGpeCustomizer extends FutureJVppCustomizer @Nonnull final ReadContext ctx) throws ReadFailedException { try { final InterfaceKey key = id.firstKeyOf(Interface.class); - // Relying here that parent InterfaceCustomizer was invoked first (PREORDER) - // to fill in the context with initial ifc mapping final int index = interfaceContext.getIndex(key.getName(), ctx.getMappingContext()); - if (!InterfaceUtils.isInterfaceOfType(ctx.getModificationCache(), index, VxlanGpeTunnel.class)) { + if (!isInterfaceOfType(getFutureJVpp(), ctx.getModificationCache(), id, index, VxlanGpeTunnel.class)) { return; } diff --git a/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/v3po/translate/v3po/interfacesstate/ip/Ipv4Customizer.java b/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/v3po/translate/v3po/interfacesstate/ip/Ipv4Customizer.java new file mode 100644 index 000000000..582d9c8e3 --- /dev/null +++ b/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/v3po/translate/v3po/interfacesstate/ip/Ipv4Customizer.java @@ -0,0 +1,101 @@ +/* + * Copyright (c) 2016 Cisco and/or its affiliates. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at: + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package io.fd.honeycomb.v3po.translate.v3po.interfacesstate.ip; + +import io.fd.honeycomb.v3po.translate.read.ReadContext; +import io.fd.honeycomb.v3po.translate.read.ReadFailedException; +import io.fd.honeycomb.v3po.translate.spi.read.ChildReaderCustomizer; +import io.fd.honeycomb.v3po.translate.v3po.util.FutureJVppCustomizer; +import io.fd.honeycomb.v3po.translate.v3po.util.NamingContext; +import io.fd.honeycomb.v3po.translate.v3po.util.TranslateUtils; +import java.util.concurrent.CompletionStage; +import java.util.stream.Collectors; +import javax.annotation.Nonnull; +import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.state.Interface; +import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.ip.rev140616.Interface2Builder; +import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.ip.rev140616.interfaces.state._interface.Ipv4; +import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.ip.rev140616.interfaces.state._interface.Ipv4Builder; +import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.ip.rev140616.interfaces.state._interface.ipv4.Address; +import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.ip.rev140616.interfaces.state._interface.ipv4.AddressBuilder; +import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.ip.rev140616.interfaces.state._interface.ipv4.address.subnet.PrefixLengthBuilder; +import org.opendaylight.yangtools.concepts.Builder; +import org.opendaylight.yangtools.yang.binding.DataObject; +import org.opendaylight.yangtools.yang.binding.InstanceIdentifier; +import org.openvpp.jvpp.VppBaseCallException; +import org.openvpp.jvpp.dto.IpAddressDetails; +import org.openvpp.jvpp.dto.IpAddressDetailsReplyDump; +import org.openvpp.jvpp.dto.IpAddressDump; +import org.openvpp.jvpp.future.FutureJVpp; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +public class Ipv4Customizer extends FutureJVppCustomizer implements ChildReaderCustomizer<Ipv4, Ipv4Builder> { + + private static final Logger LOG = LoggerFactory.getLogger(Ipv4Customizer.class); + + private final NamingContext interfaceContext; + + public Ipv4Customizer(@Nonnull final FutureJVpp futureJvpp, final NamingContext interfaceContext) { + super(futureJvpp); + this.interfaceContext = interfaceContext; + } + + @Override + public void merge(@Nonnull final Builder<? extends DataObject> parentBuilder, @Nonnull final Ipv4 readValue) { + ((Interface2Builder) parentBuilder).setIpv4(readValue); + } + + @Nonnull + @Override + public Ipv4Builder getBuilder(@Nonnull final InstanceIdentifier<Ipv4> id) { + return new Ipv4Builder(); + } + + @Override + public void readCurrentAttributes(@Nonnull final InstanceIdentifier<Ipv4> id, @Nonnull final Ipv4Builder builder, + @Nonnull final ReadContext ctx) throws ReadFailedException { + LOG.debug("Reading attributes for IPv4: {}", id); + final IpAddressDump dumpRequest = new IpAddressDump(); + dumpRequest.isIpv6 = 0; + dumpRequest.swIfIndex = interfaceContext.getIndex(id.firstKeyOf(Interface.class).getName(), ctx.getMappingContext()); + final CompletionStage<IpAddressDetailsReplyDump> addressDumpFuture = getFutureJVpp().ipAddressDump(dumpRequest); + + // TODO consider extracting customizer for address + final IpAddressDetailsReplyDump reply; + try { + reply = TranslateUtils.getReply(addressDumpFuture.toCompletableFuture()); + } catch (VppBaseCallException e) { + LOG.warn("Unable to read IPv4 attributes for {}", id, e); + throw new ReadFailedException(id, e); + } + if(reply != null && reply.ipAddressDetails != null) { + builder.setAddress( + reply.ipAddressDetails.stream() + .map(Ipv4Customizer::addressDetailsToIpv4) + .collect(Collectors.toList())); + } + + // TODO what about other children ? + } + + private static Address addressDetailsToIpv4(IpAddressDetails details) { + return new AddressBuilder() + .setIp(TranslateUtils.arrayToIpv4AddressNoZone(details.ip)) + .setSubnet(new PrefixLengthBuilder().setPrefixLength((short) details.prefixLength).build()) +// .setOrigin() + .build(); + } +} diff --git a/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/v3po/translate/v3po/interfacesstate/ip/Ipv6Customizer.java b/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/v3po/translate/v3po/interfacesstate/ip/Ipv6Customizer.java new file mode 100644 index 000000000..37524dde6 --- /dev/null +++ b/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/v3po/translate/v3po/interfacesstate/ip/Ipv6Customizer.java @@ -0,0 +1,64 @@ +/* + * Copyright (c) 2016 Cisco and/or its affiliates. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at: + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package io.fd.honeycomb.v3po.translate.v3po.interfacesstate.ip; + +import io.fd.honeycomb.v3po.translate.read.ReadContext; +import io.fd.honeycomb.v3po.translate.read.ReadFailedException; +import io.fd.honeycomb.v3po.translate.spi.read.ChildReaderCustomizer; +import io.fd.honeycomb.v3po.translate.v3po.util.FutureJVppCustomizer; +import io.fd.honeycomb.v3po.translate.v3po.util.NamingContext; +import javax.annotation.Nonnull; +import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.ip.rev140616.Interface2Builder; +import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.ip.rev140616.interfaces.state._interface.Ipv6; +import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.ip.rev140616.interfaces.state._interface.Ipv6Builder; +import org.opendaylight.yangtools.concepts.Builder; +import org.opendaylight.yangtools.yang.binding.DataObject; +import org.opendaylight.yangtools.yang.binding.InstanceIdentifier; +import org.openvpp.jvpp.future.FutureJVpp; + +public class Ipv6Customizer extends FutureJVppCustomizer implements ChildReaderCustomizer<Ipv6, Ipv6Builder> { + + private final NamingContext interfaceContext; + + public Ipv6Customizer(@Nonnull final FutureJVpp futureJvpp, final NamingContext interfaceContext) { + super(futureJvpp); + this.interfaceContext = interfaceContext; + } + + @Override + public void merge(@Nonnull final Builder<? extends DataObject> parentBuilder, @Nonnull final Ipv6 readValue) { + ((Interface2Builder) parentBuilder).setIpv6(readValue); + } + + @Nonnull + @Override + public Ipv6Builder getBuilder(@Nonnull final InstanceIdentifier<Ipv6> id) { + return new Ipv6Builder(); + } + + @Override + public void readCurrentAttributes(@Nonnull final InstanceIdentifier<Ipv6> id, @Nonnull final Ipv6Builder builder, + @Nonnull final ReadContext ctx) throws ReadFailedException { + // TODO implement +// final IpAddressDump dumpRequest = new IpAddressDump(); +// dumpRequest.isIpv6 = 1; +// dumpRequest.swIfIndex = interfaceContext.getIndex(id.firstKeyOf(Interface.class).getName(), ctx.getMappingContext()); +// final CompletionStage<IpAddressDetailsReplyDump> addressDumpFuture = getFutureJVpp().ipAddressDump(dumpRequest); + // TODO consider extracting customizer for address +// final IpAddressDetailsReplyDump reply = TranslateUtils.getReply(addressDumpFuture.toCompletableFuture()); + } + +} diff --git a/v3po/v3po2vpp/src/main/java/org/opendaylight/yang/gen/v1/urn/honeycomb/params/xml/ns/yang/v3po2vpp/rev160406/InterfacesStateHoneycombReaderModule.java b/v3po/v3po2vpp/src/main/java/org/opendaylight/yang/gen/v1/urn/honeycomb/params/xml/ns/yang/v3po2vpp/rev160406/InterfacesStateHoneycombReaderModule.java index c1a58709a..ff27694cd 100644 --- a/v3po/v3po2vpp/src/main/java/org/opendaylight/yang/gen/v1/urn/honeycomb/params/xml/ns/yang/v3po2vpp/rev160406/InterfacesStateHoneycombReaderModule.java +++ b/v3po/v3po2vpp/src/main/java/org/opendaylight/yang/gen/v1/urn/honeycomb/params/xml/ns/yang/v3po2vpp/rev160406/InterfacesStateHoneycombReaderModule.java @@ -18,13 +18,15 @@ import io.fd.honeycomb.v3po.translate.util.read.ReflexiveRootReaderCustomizer; import io.fd.honeycomb.v3po.translate.v3po.interfacesstate.EthernetCustomizer; import io.fd.honeycomb.v3po.translate.v3po.interfacesstate.InterfaceCustomizer; import io.fd.honeycomb.v3po.translate.v3po.interfacesstate.L2Customizer; -import io.fd.honeycomb.v3po.translate.v3po.interfacesstate.SubInterfaceL2Customizer; import io.fd.honeycomb.v3po.translate.v3po.interfacesstate.RewriteCustomizer; import io.fd.honeycomb.v3po.translate.v3po.interfacesstate.SubInterfaceCustomizer; +import io.fd.honeycomb.v3po.translate.v3po.interfacesstate.SubInterfaceL2Customizer; import io.fd.honeycomb.v3po.translate.v3po.interfacesstate.TapCustomizer; import io.fd.honeycomb.v3po.translate.v3po.interfacesstate.VhostUserCustomizer; import io.fd.honeycomb.v3po.translate.v3po.interfacesstate.VxlanCustomizer; import io.fd.honeycomb.v3po.translate.v3po.interfacesstate.VxlanGpeCustomizer; +import io.fd.honeycomb.v3po.translate.v3po.interfacesstate.ip.Ipv4Customizer; +import io.fd.honeycomb.v3po.translate.v3po.interfacesstate.ip.Ipv6Customizer; import java.util.ArrayList; import java.util.List; import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.InterfacesState; @@ -32,6 +34,10 @@ import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces. import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.state.Interface; import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.state.InterfaceBuilder; import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.state.InterfaceKey; +import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.ip.rev140616.Interface2; +import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.ip.rev140616.Interface2Builder; +import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.ip.rev140616.interfaces.state._interface.Ipv4; +import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.ip.rev140616.interfaces.state._interface.Ipv6; import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev150105.VppInterfaceStateAugmentation; import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev150105.VppInterfaceStateAugmentationBuilder; import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev150105.interfaces.state._interface.Ethernet; @@ -75,6 +81,7 @@ public class InterfacesStateHoneycombReaderModule extends final List<ChildReader<? extends Augmentation<Interface>>> interfaceAugReaders = new ArrayList<>(); interfaceAugReaders.add(getVppInterfaceStateAugmentationReader()); + interfaceAugReaders.add(getInterface1AugmentationReader()); interfaceAugReaders.add(getSubinterfaceStateAugmentationReader()); final CompositeListReader<Interface, InterfaceKey, InterfaceBuilder> interfaceReader = @@ -90,6 +97,19 @@ public class InterfacesStateHoneycombReaderModule extends new ReflexiveRootReaderCustomizer<>(InterfacesStateBuilder.class))); } + private ChildReader<? extends Augmentation<Interface>> getInterface1AugmentationReader() { + final List<ChildReader<? extends ChildOf<Interface2>>> interface1ChildWriters = Lists.newArrayList(); + + final ChildReader<? extends ChildOf<Interface2>> ipv4Reader = new CompositeChildReader<>(Ipv4.class, + new Ipv4Customizer(getVppJvppDependency(), getInterfaceContextIfcStateDependency())); + final ChildReader<? extends ChildOf<Interface2>> ipv6Reader = new CompositeChildReader<>(Ipv6.class, + new Ipv6Customizer(getVppJvppDependency(), getInterfaceContextIfcStateDependency())); + interface1ChildWriters.add(ipv4Reader); + interface1ChildWriters.add(ipv6Reader); + + return new CompositeChildReader<>(Interface2.class, + interface1ChildWriters, new ReflexiveAugmentReaderCustomizer<>(Interface2Builder.class, Interface2.class)); + } private ChildReader<? extends Augmentation<Interface>> getVppInterfaceStateAugmentationReader() { diff --git a/v3po/vpp-translate-utils/src/main/java/io/fd/honeycomb/v3po/translate/v3po/util/TranslateUtils.java b/v3po/vpp-translate-utils/src/main/java/io/fd/honeycomb/v3po/translate/v3po/util/TranslateUtils.java index 9c3fea615..d68ea19b7 100644 --- a/v3po/vpp-translate-utils/src/main/java/io/fd/honeycomb/v3po/translate/v3po/util/TranslateUtils.java +++ b/v3po/vpp-translate-utils/src/main/java/io/fd/honeycomb/v3po/translate/v3po/util/TranslateUtils.java @@ -16,23 +16,25 @@ package io.fd.honeycomb.v3po.translate.v3po.util; -import com.google.common.base.Splitter; -import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv4AddressNoZone; -import org.opendaylight.yangtools.yang.binding.InstanceIdentifier; -import org.openvpp.jvpp.VppBaseCallException; -import org.openvpp.jvpp.dto.JVppReply; +import static com.google.common.base.Preconditions.checkArgument; -import javax.annotation.Nonnegative; -import javax.annotation.Nonnull; -import javax.annotation.Nullable; +import com.google.common.base.Splitter; +import com.google.common.net.InetAddresses; +import java.net.UnknownHostException; +import java.util.Arrays; import java.util.List; import java.util.concurrent.ExecutionException; import java.util.concurrent.Future; import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeoutException; import java.util.function.BiConsumer; - -import static com.google.common.base.Preconditions.checkArgument; +import javax.annotation.Nonnegative; +import javax.annotation.Nonnull; +import javax.annotation.Nullable; +import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv4AddressNoZone; +import org.opendaylight.yangtools.yang.binding.InstanceIdentifier; +import org.openvpp.jvpp.VppBaseCallException; +import org.openvpp.jvpp.dto.JVppReply; public final class TranslateUtils { @@ -77,17 +79,44 @@ public final class TranslateUtils { } } + /** + * Transform Ipv4 address to a byte array acceptable by VPP. VPP expects incoming byte array to be + * in the same order as the address. + * + * @return byte array with address bytes + */ public static byte[] ipv4AddressNoZoneToArray(final Ipv4AddressNoZone ipv4Addr) { byte[] retval = new byte[4]; String[] dots = ipv4Addr.getValue().split("\\."); - for (int d = 3; d >= 0; d--) { - retval[d] = (byte) (Short.parseShort(dots[3 - d]) & 0xff); + for (int d = 0; d < 4; d++) { + retval[d] = (byte) (Short.parseShort(dots[d]) & 0xff); } return retval; } /** + * Parse byte array returned by VPP representing an Ipv4 address. Vpp returns IP byte arrays in reversed order. + * + * @return Ipv4AddressNoZone containing string representation of IPv4 address constructed from submitted bytes. No + * change in order. + */ + @Nonnull + public static Ipv4AddressNoZone arrayToIpv4AddressNoZone(@Nonnull byte[] ip) { + // VPP sends ipv4 in a 16 byte array + if(ip.length == 16) { + ip = Arrays.copyOfRange(ip, 0, 4); + } + try { + // Not reversing the byte array here!! because the IP coming from VPP is in reversed byte order + // compared to byte order it was submitted + return new Ipv4AddressNoZone(InetAddresses.toAddrString(InetAddresses.fromLittleEndianByteArray(ip))); + } catch (UnknownHostException e) { + throw new IllegalArgumentException("Unable to parse ipv4", e); + } + } + + /** * Return (interned) string from byte array while removing \u0000. * Strings represented as fixed length byte[] from vpp contain \u0000. */ diff --git a/v3po/vpp-translate-utils/src/test/java/io/fd/honeycomb/v3po/translate/v3po/util/TranslateUtilsTest.java b/v3po/vpp-translate-utils/src/test/java/io/fd/honeycomb/v3po/translate/v3po/util/TranslateUtilsTest.java index 0a851e8c4..ba3861b99 100644 --- a/v3po/vpp-translate-utils/src/test/java/io/fd/honeycomb/v3po/translate/v3po/util/TranslateUtilsTest.java +++ b/v3po/vpp-translate-utils/src/test/java/io/fd/honeycomb/v3po/translate/v3po/util/TranslateUtilsTest.java @@ -4,10 +4,32 @@ import static org.junit.Assert.assertArrayEquals; import static org.junit.Assert.assertEquals; import org.junit.Test; +import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv4AddressNoZone; public class TranslateUtilsTest { @Test + public void testIpv4NoZone() throws Exception { + final Ipv4AddressNoZone ipv4Addr = new Ipv4AddressNoZone("192.168.1.1"); + byte[] bytes = TranslateUtils.ipv4AddressNoZoneToArray(ipv4Addr); + assertEquals((byte)192, bytes[0]); + // Simulating the magic of VPP + bytes = reverseBytes(bytes); + final Ipv4AddressNoZone ipv4AddressNoZone = TranslateUtils.arrayToIpv4AddressNoZone(bytes); + assertEquals(ipv4Addr, ipv4AddressNoZone); + } + + private byte[] reverseBytes(final byte[] bytes) { + final byte[] reversed = new byte[bytes.length]; + int i = 1; + for (byte aByte : bytes) { + reversed[bytes.length - i++] = aByte; + } + + return reversed; + } + + @Test public void testToString() { final byte[] expected = "test".getBytes(); final byte[] cString = new byte[expected.length + 10]; |