From 911c06fcdc66e0e7d8a4af911070fd56bd782029 Mon Sep 17 00:00:00 2001 From: igor Date: Sat, 20 Sep 2014 23:07:09 +0100 Subject: [PATCH] Adds code to examples to create router as stated Closes bug 1371982 Change-Id: I60dd7622dcd864e59e22cde9d7156a62051eff17 --- doc/user-guide/section_sdk_neutron.xml | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/doc/user-guide/section_sdk_neutron.xml b/doc/user-guide/section_sdk_neutron.xml index c22ce38e3f..f9df5b6308 100644 --- a/doc/user-guide/section_sdk_neutron.xml +++ b/doc/user-guide/section_sdk_neutron.xml @@ -265,13 +265,19 @@ from utils import print_values_server Create a router and add a port to the subnet: - # Replace with server_id and network_id from your environment + # Replace with network_id from your environment -router_id = '72cf1682-60a8-4890-b0ed-6bad7d9f5466' network_id = '81bf592a-9e3f-4f84-a839-ae87df188dc1' credentials = get_credentials() neutron = client.Client(**credentials) +neutron.format = json +request = {'router': {'name': 'router name', + 'admin_state_up': True}} + +router = neutron.create_router(request) +router_id = router['router']['id'] +# for example: '72cf1682-60a8-4890-b0ed-6bad7d9f5466' router = neutron.show_router(router_id) print(router) body_value = {'port': { @@ -298,13 +304,18 @@ from utils import print_values_server credentials = get_nova_credentials() nova_client = nvclient.Client(**credentials) -# Replace with server_id and network_id from your environment +# Replace with network_id from your environment -router_id = '72cf1682-60a8-4890-b0ed-6bad7d9f5466' network_id = '81bf592a-9e3f-4f84-a839-ae87df188dc1' try: credentials = get_credentials() neutron = client.Client(**credentials) + neutron.format = 'json' + request = {'router': {'name': 'router name', + 'admin_state_up': True}} + router = neutron.create_router(request) + router_id = router['router']['id'] + # for example: '72cf1682-60a8-4890-b0ed-6bad7d9f5466' router = neutron.show_router(router_id) print(router) body_value = {'port': {