diff --git a/module03/03-environment-03-mission/hello_lab.py b/module03/03-environment-03-mission/hello_lab.py index adda2e2..952714e 100755 --- a/module03/03-environment-03-mission/hello_lab.py +++ b/module03/03-environment-03-mission/hello_lab.py @@ -8,22 +8,22 @@ # we need to know our token TOKEN = 'insert-your-token-from-developer.ciscospark.com-here' -NAME = 'existing-event-room-name-inserted-here' +NAME = 'existing-event-room-name-inserted-here' RESTCONF = 'insert-restconf-ip-or-url-here' APIC_EM = 'insert-apic-em-ip-or-url-here' #Function to check if restconf is accessible def check_restconf(address): - # Retconf enabled device's address and default entry level - restconf_api= "https://"+address+"/api" + # Retconf enabled device's address and default entry level + restconf_api= "http://"+address+":8008/api" # Parameter passed during the call params = {"verbose" : ""} # Necessary headers to make an API call headers = { - "authorization" : "Basic cm9vdDpDIXNjMDEyMw==", + "authorization" : "Basic YWRtaW46QzFzY28xMjM0NQ==", "content-type" : "application/vnd.yang.data+json", "accept" : "application/vnd.yang.api+json" } @@ -46,8 +46,8 @@ def check_apic_em(address): "content-type": "application/json" } payload = { - "username" : "devnetuser", - "password" : "Cisco123!" + "username" : "admin", + "password" : "C1sco12345" } #Making Rest call apic_em_response = requests.post(apic_em_api, headers=headers, data=json.dumps(payload), verify=False) @@ -80,4 +80,3 @@ def check_apic_em(address): else: spark_send_message(TOKEN, room_id, 'Unfortunately, APIC-EM is working properly.\n') print("Please check room " + NAME + ", there are messages posted on your behalf") - diff --git a/module06/06-dmi-01-overview-of-device-level-netconf/get_hostname.py b/module06/06-dmi-01-overview-of-device-level-netconf/get_hostname.py index 4e94969..3086362 100644 --- a/module06/06-dmi-01-overview-of-device-level-netconf/get_hostname.py +++ b/module06/06-dmi-01-overview-of-device-level-netconf/get_hostname.py @@ -9,13 +9,12 @@ # the variables below assume the user is leveraging the # network programmability lab and accessing csr1000v # use the IP address or hostname of your CSR1000V device -HOST = 'ios-xe-mgmt.cisco.com' +HOST = '198.18.133.218' # use the NETCONF port for your CSR1000V device -PORT = 10000 +PORT = 2022 # use the user credentials for your CSR1000V device -USER = 'root' -PASS = 'C!sc0123' - +USER = 'admin' +PASS = 'C1sco12345' # create a main() method def main(): diff --git a/module06/06-dmi-02-yang-data-modeling-overview/get_capabilities.py b/module06/06-dmi-02-yang-data-modeling-overview/get_capabilities.py index 680fb43..b6a3db3 100644 --- a/module06/06-dmi-02-yang-data-modeling-overview/get_capabilities.py +++ b/module06/06-dmi-02-yang-data-modeling-overview/get_capabilities.py @@ -6,12 +6,12 @@ # the variables below assume the user is leveraging the # network programmability lab and accessing csr1000v # use the IP address or hostname of your CSR1000V device -HOST = 'ios-xe-mgmt.cisco.com' +HOST = '198.18.133.218' # use the NETCONF port for your CSR1000V device -PORT = 10000 +PORT = 2022 # use the user credentials for your CSR1000V device -USER = 'root' -PASS = 'C!sc0123' +USER = 'admin' +PASS = 'C1sco12345' # create a main() method def main(): diff --git a/module06/06-dmi-02-yang-data-modeling-overview/get_hostname.py b/module06/06-dmi-02-yang-data-modeling-overview/get_hostname.py index 4e94969..8e1d363 100644 --- a/module06/06-dmi-02-yang-data-modeling-overview/get_hostname.py +++ b/module06/06-dmi-02-yang-data-modeling-overview/get_hostname.py @@ -9,12 +9,12 @@ # the variables below assume the user is leveraging the # network programmability lab and accessing csr1000v # use the IP address or hostname of your CSR1000V device -HOST = 'ios-xe-mgmt.cisco.com' +HOST = '198.18.133.218' # use the NETCONF port for your CSR1000V device -PORT = 10000 +PORT = 2022 # use the user credentials for your CSR1000V device -USER = 'root' -PASS = 'C!sc0123' +USER = 'admin' +PASS = 'C1sco12345' # create a main() method diff --git a/module06/06-dmi-02-yang-data-modeling-overview/get_ietf_interfaces.py b/module06/06-dmi-02-yang-data-modeling-overview/get_ietf_interfaces.py index 88c2087..9c5ea45 100644 --- a/module06/06-dmi-02-yang-data-modeling-overview/get_ietf_interfaces.py +++ b/module06/06-dmi-02-yang-data-modeling-overview/get_ietf_interfaces.py @@ -10,12 +10,12 @@ # the variables below assume the user is leveraging the # network programmability lab and accessing csr1000v # use the IP address or hostname of your CSR1000V device -HOST = 'ios-xe-mgmt.cisco.com' +HOST = '198.18.133.218' # use the NETCONF port for your CSR1000V device -PORT = 10000 +PORT = 2022 # use the user credentials for your CSR1000V device -USER = 'root' -PASS = 'C!sc0123' +USER = 'admin' +PASS = 'C1sco12345' MODULE_NAME = 'ietf-interfaces.yang' diff --git a/module06/06-dmi-02-yang-data-modeling-overview/get_interfaces_config.py b/module06/06-dmi-02-yang-data-modeling-overview/get_interfaces_config.py index c73bfe1..cc5d12b 100644 --- a/module06/06-dmi-02-yang-data-modeling-overview/get_interfaces_config.py +++ b/module06/06-dmi-02-yang-data-modeling-overview/get_interfaces_config.py @@ -13,12 +13,12 @@ # the variables below assume the user is leveraging the # network programmability lab and accessing csr1000v # use the IP address or hostname of your CSR1000V device -HOST = 'ios-xe-mgmt.cisco.com' +HOST = '198.18.133.218' # use the NETCONF port for your CSR1000V device -PORT = 10000 +PORT = 2022 # use the user credentials for your CSR1000V device -USER = 'root' -PASS = 'C!sc0123' +USER = 'admin' +PASS = 'C1sco12345' # XML file to open FILE = 'get_interfaces.xml' diff --git a/module06/06-dmi-03-using-restconf-to-interface-with-networking-devices/dCloud.postman_environment b/module06/06-dmi-03-using-restconf-to-interface-with-networking-devices/dCloud.postman_environment new file mode 100644 index 0000000..43866a1 --- /dev/null +++ b/module06/06-dmi-03-using-restconf-to-interface-with-networking-devices/dCloud.postman_environment @@ -0,0 +1,34 @@ +{ + "id": "1a8f4537-91f1-04b5-397a-d5fbc47c4c39", + "name": "dCloud", + "values": [ + { + "key": "host", + "value": "198.18.133.218", + "type": "text", + "enabled": true + }, + { + "key": "port", + "value": "8008", + "type": "text", + "enabled": true + }, + { + "key": "username", + "value": "admin", + "type": "text", + "enabled": true + }, + { + "key": "password", + "value": "C1sco12345", + "type": "text", + "enabled": true + } + ], + "timestamp": 1473883564692, + "_postman_variable_scope": "environment", + "_postman_exported_at": "2016-09-14T20:06:09.958Z", + "_postman_exported_using": "Postman/4.7.1" +} \ No newline at end of file diff --git a/module06/06-dmi-03-using-restconf-to-interface-with-networking-devices/network-programmability-lab.postman_environment b/module06/06-dmi-03-using-restconf-to-interface-with-networking-devices/network-programmability-lab.postman_environment deleted file mode 100644 index a4629f1..0000000 --- a/module06/06-dmi-03-using-restconf-to-interface-with-networking-devices/network-programmability-lab.postman_environment +++ /dev/null @@ -1,17 +0,0 @@ -{ - "id": "acbd1224-93f8-99d4-389a-a26caefa742d", - "name": "network-programmability-lab", - "values": [ - { - "key": "host", - "value": "devnetapi.cisco.com/sandbox/restconf", - "type": "text", - "enabled": true - } - ], - "timestamp": 1471660038709, - "synced": false, - "syncedFilename": "", - "team": null, - "isDeleted": false -} \ No newline at end of file diff --git a/module06/06-dmi-03-using-restconf-to-interface-with-networking-devices/RESTCONF_DemoAlways_On_Lab.postman_collection b/module06/06-dmi-03-using-restconf-to-interface-with-networking-devices/restconflab.json.postman_collection similarity index 54% rename from module06/06-dmi-03-using-restconf-to-interface-with-networking-devices/RESTCONF_DemoAlways_On_Lab.postman_collection rename to module06/06-dmi-03-using-restconf-to-interface-with-networking-devices/restconflab.json.postman_collection index 28dad4c..fa3eec4 100644 --- a/module06/06-dmi-03-using-restconf-to-interface-with-networking-devices/RESTCONF_DemoAlways_On_Lab.postman_collection +++ b/module06/06-dmi-03-using-restconf-to-interface-with-networking-devices/restconflab.json.postman_collection @@ -1,27 +1,27 @@ { - "id": "e8da6ab3-9a68-8521-7b88-e6e70bdf76c3", + "id": "305dc2d1-9cab-f4e7-e6f7-6e695775a3fe", "name": "RESTCONF Demo", "description": "", "order": [ - "c3b82b3a-dcf5-7406-f488-03c74a89cd22", - "60d40304-a496-c6a4-dd07-964cfa5baaec", - "cbb61689-cb5d-0c5c-f2de-f8664111d680", - "0d92682f-d7f4-0c49-a4a3-5ea93daad6b6", - "53399405-931b-c5e8-fadf-ba583bbea5bc", - "edf3adcb-6b48-1c0f-394b-a678a7638c7b", - "af32090a-3be6-d7e2-6742-22bc72fb48da", - "43ffcc5b-8a3c-6f86-1dd9-2669c851f482" + "56ab592e-9f33-cde8-5c34-348ddee0ae27", + "9765d0cd-f180-98fe-ebeb-25a45e4155e1", + "e012e9be-5845-6a9e-a07f-63c1028c6227", + "9ef4b230-5660-d140-22eb-8f822ed6cc08", + "a3e1f19a-1bd5-bee0-9735-c364d2792273", + "ff3f2359-a412-6c73-6654-e1109901ec9d", + "cb1b1c94-a19a-6795-1902-de9c9f652d1c", + "6bfb588b-2bdf-028b-2f4a-816eb67782d7" ], "folders": [], "timestamp": 1454405097725, - "owner": "553027", + "owner": 0, + "remoteLink": "", "public": false, - "hasRequests": true, "requests": [ { - "id": "0d92682f-d7f4-0c49-a4a3-5ea93daad6b6", - "headers": "Authorization: Basic cm9vdDpDIXNjMDEyMw==\nContent-Type: application/vnd.yang.data+json\nAccept: application/vnd.yang.data+json\n", - "url": "https://{{host}}/api/running/interfaces/interface/GigabitEthernet1?deep", + "id": "56ab592e-9f33-cde8-5c34-348ddee0ae27", + "headers": "Authorization: Basic YWRtaW46QzFzY28xMjM0NQ==\nContent-Type: application/vnd.yang.data+json\nAccept: application/vnd.yang.api+json\n", + "url": "http://{{host}}:{{port}}/api?verbose", "preRequestScript": "", "pathVariables": {}, "method": "GET", @@ -29,23 +29,18 @@ "dataMode": "params", "version": 2, "tests": "", - "currentHelper": "basicAuth", - "helperAttributes": { - "id": "basic", - "username": "root", - "password": "C!sc0123", - "saveToRequest": true - }, - "time": 1471621490005, - "name": "Read ietf-interfaces single interface", - "description": "This reads a single interface from the IOS XE box which already has been configured as a 802.1Q subinterface", - "collectionId": "e8da6ab3-9a68-8521-7b88-e6e70bdf76c3", + "currentHelper": "normal", + "helperAttributes": {}, + "time": 1467219196976, + "name": "Read the top level REST resource", + "description": "/api is the top level REST resource.\nReading this resource shows what datastores\nare available and what operations are available.\n\nOperations are executed by sending a GET command\nto the URL identified for the operation.", + "collectionId": "305dc2d1-9cab-f4e7-e6f7-6e695775a3fe", "responses": [] }, { - "id": "43ffcc5b-8a3c-6f86-1dd9-2669c851f482", + "id": "6bfb588b-2bdf-028b-2f4a-816eb67782d7", "headers": "Authorization: Basic YWRtaW46QzFzY28xMjM0NQ==\nAccept: application/vnd.yang.data+json\n", - "url": "https://{{host}}/api/running/routing/routing-instance/default/routing-protocols?deep", + "url": "http://{{host}}:{{port}}/api/running/routing/routing-instance/default/routing-protocols?deep", "preRequestScript": "", "pathVariables": {}, "method": "GET", @@ -53,71 +48,56 @@ "dataMode": "params", "version": 2, "tests": "", - "currentHelper": "basicAuth", - "helperAttributes": { - "id": "basic", - "username": "root", - "password": "C!sc0123", - "saveToRequest": true - }, - "time": 1471621620225, + "currentHelper": "normal", + "helperAttributes": {}, + "time": 1467218961156, "name": "read IETF-routing configuration data", "description": "", - "collectionId": "e8da6ab3-9a68-8521-7b88-e6e70bdf76c3", + "collectionId": "305dc2d1-9cab-f4e7-e6f7-6e695775a3fe", "responses": [] }, { - "id": "53399405-931b-c5e8-fadf-ba583bbea5bc", - "headers": "Authorization: Basic cm9vdDpDIXNjMDEyMw==\nContent-Type: application/vnd.yang.data+json\nAccept: application/vnd.yang.data+json\n", - "url": "https://{{host}}/api/running/native/interface/GigabitEthernet/1?deep", + "id": "9765d0cd-f180-98fe-ebeb-25a45e4155e1", + "headers": "Authorization: Basic YWRtaW46QzFzY28xMjM0NQ==\nContent-Type: application/vnd.yang.data+json\nAccept: application/vnd.yang.data+json\n", + "url": "http://{{host}}:{{port}}/api/operational/netconf-state/capabilities", "preRequestScript": "", "pathVariables": {}, "method": "GET", "data": [], "dataMode": "params", "version": 2, - "tests": "", - "currentHelper": "basicAuth", - "helperAttributes": { - "id": "basic", - "username": "root", - "password": "C!sc0123", - "saveToRequest": true - }, - "time": 1471621541563, - "name": "Read native device single interface", - "description": "This reads a single interface from the IOS XE box which already has been configured as a 802.1Q subinterface\nIt uses the native device model (e.g. NED, network element driver)", - "collectionId": "e8da6ab3-9a68-8521-7b88-e6e70bdf76c3", + "tests": "tests[\"Body matches string\"] = responseBody.has(\"interface\");", + "currentHelper": "normal", + "helperAttributes": {}, + "time": 1467219177312, + "name": "Read models implemented by the device", + "description": "This command reads a subset of the information available\nin the ietf-netconf-monitoring model. The information returned\nis the list of all models, revisions, deviations on this device.\n\nUsing this command is the definitive way to determine the exact\nimplementation and versions on the device. This information can\nbe used by an intelligent management client to make decisions\non how to use the RESTCONF interface.\n\nThis example for the ietf-interfaces model identifies the \nrevision data as 5.8.2014 and lists specific feature options\nsupported and also the name of the module applying deviations \nthat change the information exposed by the model.\n\n \"urn:ietf:params:xml:ns:yang:\n ietf-interfaces?module=ietf-interfaces&\n revision=2014-05-08&features=pre-provisioning,if-mib,\n arbitrary-names&deviations=ietf-ip-devs\",\n", + "collectionId": "305dc2d1-9cab-f4e7-e6f7-6e695775a3fe", "responses": [] }, { - "id": "60d40304-a496-c6a4-dd07-964cfa5baaec", + "id": "9ef4b230-5660-d140-22eb-8f822ed6cc08", "headers": "Authorization: Basic YWRtaW46QzFzY28xMjM0NQ==\nContent-Type: application/vnd.yang.data+json\nAccept: application/vnd.yang.data+json\n", - "url": "https://{{host}}/api/operational/netconf-state/capabilities", + "url": "http://{{host}}:{{port}}/api/running/interfaces/interface/GigabitEthernet1?deep", "preRequestScript": "", "pathVariables": {}, "method": "GET", "data": [], "dataMode": "params", "version": 2, - "tests": "tests[\"Body matches string\"] = responseBody.has(\"interface\");", - "currentHelper": "basicAuth", - "helperAttributes": { - "id": "basic", - "username": "root", - "password": "C!sc0123", - "saveToRequest": true - }, - "time": 1471621068270, - "name": "Read models implemented by the device", - "description": "This command reads a subset of the information available\nin the ietf-netconf-monitoring model. The information returned\nis the list of all models, revisions, deviations on this device.\n\nUsing this command is the definitive way to determine the exact\nimplementation and versions on the device. This information can\nbe used by an intelligent management client to make decisions\non how to use the RESTCONF interface.\n\nThis example for the ietf-interfaces model identifies the \nrevision data as 5.8.2014 and lists specific feature options\nsupported and also the name of the module applying deviations \nthat change the information exposed by the model.\n\n \"urn:ietf:params:xml:ns:yang:\n ietf-interfaces?module=ietf-interfaces&\n revision=2014-05-08&features=pre-provisioning,if-mib,\n arbitrary-names&deviations=ietf-ip-devs\",\n", - "collectionId": "e8da6ab3-9a68-8521-7b88-e6e70bdf76c3", + "tests": "", + "currentHelper": "normal", + "helperAttributes": {}, + "time": 1467219133345, + "name": "Read ietf-interfaces single interface", + "description": "This reads a single interface from the IOS XE box which already has been configured as a 802.1Q subinterface", + "collectionId": "305dc2d1-9cab-f4e7-e6f7-6e695775a3fe", "responses": [] }, { - "id": "af32090a-3be6-d7e2-6742-22bc72fb48da", - "headers": "Authorization: Basic cm9vdDpDIXNjMDEyMw==\nAccept: application/vnd.yang.data+json\n", - "url": "https://{{host}}/api/operational/routing-state/routing-instance/default/ribs/rib/ipv4-default/routes?deep", + "id": "a3e1f19a-1bd5-bee0-9735-c364d2792273", + "headers": "Authorization: Basic YWRtaW46QzFzY28xMjM0NQ==\nContent-Type: application/vnd.yang.data+json\nAccept: application/vnd.yang.data+json\n", + "url": "http://{{host}}:{{port}}/api/running/native/interface/GigabitEthernet/1?deep", "preRequestScript": "", "pathVariables": {}, "method": "GET", @@ -125,23 +105,18 @@ "dataMode": "params", "version": 2, "tests": "", - "currentHelper": "basicAuth", - "helperAttributes": { - "id": "basic", - "username": "root", - "password": "C!sc0123", - "saveToRequest": true - }, - "time": 1471621601805, - "name": "read IETF-routing operational data (RIB)", - "description": "", - "collectionId": "e8da6ab3-9a68-8521-7b88-e6e70bdf76c3", + "currentHelper": "normal", + "helperAttributes": {}, + "time": 1467219111034, + "name": "Read native device single interface", + "description": "This reads a single interface from the IOS XE box which already has been configured as a 802.1Q subinterface\nIt uses the native device model (e.g. NED, network element driver)", + "collectionId": "305dc2d1-9cab-f4e7-e6f7-6e695775a3fe", "responses": [] }, { - "id": "c3b82b3a-dcf5-7406-f488-03c74a89cd22", - "headers": "Authorization: Basic cm9vdDpDIXNjMDEyMw==\nContent-Type: application/vnd.yang.data+json\nAccept: application/vnd.yang.api+json\n", - "url": "https://{{host}}/api?verbose", + "id": "cb1b1c94-a19a-6795-1902-de9c9f652d1c", + "headers": "Authorization: Basic YWRtaW46QzFzY28xMjM0NQ==\nAccept: application/vnd.yang.data+json\n", + "url": "http://{{host}}:{{port}}/api/operational/routing-state/routing-instance/default/ribs/rib/ipv4-default/routes?deep", "preRequestScript": "", "pathVariables": {}, "method": "GET", @@ -149,23 +124,18 @@ "dataMode": "params", "version": 2, "tests": "", - "currentHelper": "basicAuth", - "helperAttributes": { - "id": "basic", - "username": "root", - "password": "C!sc0123", - "saveToRequest": true - }, - "time": 1471621008204, - "name": "Read the top level REST resource", - "description": "/api is the top level REST resource.\nReading this resource shows what datastores\nare available and what operations are available.\n\nOperations are executed by sending a GET command\nto the URL identified for the operation.", - "collectionId": "e8da6ab3-9a68-8521-7b88-e6e70bdf76c3", + "currentHelper": "normal", + "helperAttributes": {}, + "time": 1467218997364, + "name": "read IETF-routing operational data (RIB)", + "description": "", + "collectionId": "305dc2d1-9cab-f4e7-e6f7-6e695775a3fe", "responses": [] }, { - "id": "cbb61689-cb5d-0c5c-f2de-f8664111d680", + "id": "e012e9be-5845-6a9e-a07f-63c1028c6227", "headers": "Authorization: Basic YWRtaW46QzFzY28xMjM0NQ==\nContent-Type: application/vnd.yang.data+json\nAccept: application/vnd.yang.data+json\n", - "url": "https://{{host}}/api/running/interfaces", + "url": "http://{{host}}:{{port}}/api/running/interfaces", "preRequestScript": "", "pathVariables": {}, "method": "GET", @@ -173,23 +143,18 @@ "dataMode": "params", "version": 2, "tests": "", - "currentHelper": "basicAuth", - "helperAttributes": { - "id": "basic", - "username": "root", - "password": "C!sc0123", - "saveToRequest": true - }, - "time": 1471621088199, + "currentHelper": "normal", + "helperAttributes": {}, + "time": 1467219143817, "name": "Read ietf-interfaces list of interface names", "description": "This message uses the ietf-interface model to read\na list of the names of each interface managed using\nthe model. The model mapping infrastructure converts\nthe native model configuration into the form defined\nby the ietf-interfaces common model\n\n{\n \"ietf-interfaces:interfaces\": {\n \"interface\": [\n {\n \"name\": \"FastEthernet0/0/0\"\n },\n {\n \"name\": \"FastEthernet0/0/1\"\n },\n {\n \"name\": \"FastEthernet0/0/2\"\n },", - "collectionId": "e8da6ab3-9a68-8521-7b88-e6e70bdf76c3", + "collectionId": "305dc2d1-9cab-f4e7-e6f7-6e695775a3fe", "responses": [] }, { - "id": "edf3adcb-6b48-1c0f-394b-a678a7638c7b", + "id": "ff3f2359-a412-6c73-6654-e1109901ec9d", "headers": "Authorization: Basic YWRtaW46QzFzY28xMjM0NQ==\nContent-Type: application/vnd.yang.data+json\nAccept: application/vnd.yang.data+json\n", - "url": "https://{{host}}/api/running/cisco-ia/odm-control", + "url": "http://{{host}}:{{port}}/api/running/cisco-ia/odm-control", "preRequestScript": "", "pathVariables": {}, "method": "PUT", @@ -197,17 +162,12 @@ "dataMode": "raw", "version": 2, "tests": "", - "currentHelper": "basicAuth", - "helperAttributes": { - "id": "basic", - "username": "root", - "password": "C!sc0123", - "saveToRequest": true - }, - "time": 1471621564771, + "currentHelper": "normal", + "helperAttributes": {}, + "time": 1467208197301, "name": "En-/Disable ODM", "description": "", - "collectionId": "e8da6ab3-9a68-8521-7b88-e6e70bdf76c3", + "collectionId": "305dc2d1-9cab-f4e7-e6f7-6e695775a3fe", "responses": [], "rawModeData": "{ \"odm-control\": \"true\" }" } diff --git a/module06/06-dmi-04-mission/create_subinterface.py b/module06/06-dmi-04-mission/create_subinterface.py index 85c5854..b1fd28d 100644 --- a/module06/06-dmi-04-mission/create_subinterface.py +++ b/module06/06-dmi-04-mission/create_subinterface.py @@ -17,10 +17,10 @@ import myspark -HOST = 'devnetapi.cisco.com/sandbox/restconf' -PORT = 9443 -USER = 'root' -PASS = 'C!sc0123' +HOST = '198.18.133.218' +PORT = 8008 +USER = 'admin' +PASS = 'C1sco12345' BASE = 'GigabitEthernet2' @@ -71,7 +71,7 @@ def create_vlan(host, port, user, password, interface, vlan, ip, insecure): ''' % (ip.ip, ip.netmask) data = data % (m.group(1), m.group(2), vlan, vlan, ipdata) - url = "https://%s/api/running/native/interface/%s/%s.%d" % (host, m.group(1), m.group(2), vlan) + url = "http://%s:%s/api/running/native/interface/%s/%s.%d" % (host, port, m.group(1), m.group(2), vlan) headers = {'content-type': 'application/vnd.yang.data+json', 'accept': 'application/vnd.yang.data+json'} try: diff --git a/module06/06-dmi-04-mission/get_interfaces.py b/module06/06-dmi-04-mission/get_interfaces.py index 4c729e6..69d7723 100644 --- a/module06/06-dmi-04-mission/get_interfaces.py +++ b/module06/06-dmi-04-mission/get_interfaces.py @@ -3,14 +3,15 @@ import requests import sys -HOST = 'devnetapi.cisco.com/sandbox/restconf' -USER = 'root' -PASS = 'C!sc0123' +HOST = '198.18.133.218' +PORT = 8008 +USER = 'admin' +PASS = 'C1sco12345' requests.packages.urllib3.disable_warnings() def get_configured_interfaces(): """Retrieving config data (interface) from RESTCONF.""" - url = "https://{h}/api/running/interfaces".format(h=HOST) + url = "http://{h}:{p}/api/running/interfaces".format(h=HOST, p=PORT) # RESTCONF media types for REST API headers headers = {'Content-Type': 'application/vnd.yang.data+json', 'Accept': 'application/vnd.yang.data+json'}