Skip to content

Instantly share code, notes, and snippets.

@zhanghui9700
Last active June 1, 2016 02:42
Show Gist options
  • Save zhanghui9700/f2254652406efca82dbd94a432e721db to your computer and use it in GitHub Desktop.
Save zhanghui9700/f2254652406efca82dbd94a432e721db to your computer and use it in GitHub Desktop.
openstack neutron api response

neutron

neutronclient(request).list_networks(**params).get('networks')

{                                                                           
  "networks": [                                                             
    {                                                                       
      "status": "ACTIVE",                                                   
      "subnets": [                                                          
        "a9c9fdd5-6491-4611-9ad2-97ac01622a52"                              
      ],                                                                    
      "name": "net04",                                                      
      "provider:physical_network": "physnet2",                              
      "router:external": false,                                             
      "tenant_id": "7d44f5516fac4b489060da019c35b2db",                      
      "admin_state_up": true,                                               
      "mtu": 1500,                                                          
      "shared": false,                                                      
      "provider:network_type": "vlan",                                      
      "id": "a3d4d57c-1b8d-42aa-9540-d45a035d65c6",                         
      "provider:segmentation_id": 200                                       
    },                                                                      
    {                                                                       
      "status": "ACTIVE",                                                   
      "subnets": [                                                          
        "38cc31ff-2a19-4098-89f9-7278ed532df8"                              
      ],                                                                    
      "name": "net04_ext",                                                  
      "provider:physical_network": null,                                    
      "router:external": true,                                              
      "tenant_id": "7d44f5516fac4b489060da019c35b2db",                      
      "admin_state_up": true,                                               
      "mtu": 0,                                                             
      "shared": false,                                                      
      "provider:network_type": "local",                                     
      "id": "32d85ddf-9953-4a64-83f6-61ffb44c5595",                         
      "provider:segmentation_id": null                                      
    }                                                                       
  ]                                                                         
}

neutronclient(request).list_subnets(**params).get('subnets')

{                                                                              
  "subnets": [                                                                 
    {                                                                          
      "name": "net04__subnet",                                                 
      "enable_dhcp": true,                                                     
      "network_id": "a3d4d57c-1b8d-42aa-9540-d45a035d65c6",                    
      "tenant_id": "7d44f5516fac4b489060da019c35b2db",                         
      "dns_nameservers": [                                                     
        "114.114.114.114",                                                     
        "114.114.115.115"                                                   
      ],                                                                    
      "gateway_ip": "192.168.111.1",                                        
      "ipv6_ra_mode": null,                                                 
      "allocation_pools": [                                                 
        {                                                                   
          "start": "192.168.111.2",                                         
          "end": "192.168.111.254"                                          
        }                                                                   
      ],                                                                    
      "host_routes": [],                                                    
      "ip_version": 4,                                                      
      "ipv6_address_mode": null,                                            
      "cidr": "192.168.111.0/24",                                           
      "id": "a9c9fdd5-6491-4611-9ad2-97ac01622a52",                         
      "subnetpool_id": null                                                 
    },                                                                      
    {                                                                       
      "name": "net04_ext__subnet",                                          
      "enable_dhcp": false,                                                 
      "network_id": "32d85ddf-9953-4a64-83f6-61ffb44c5595",                 
      "tenant_id": "7d44f5516fac4b489060da019c35b2db",                      
      "dns_nameservers": [],                                                
      "gateway_ip": "14.14.14.1",                                           
      "ipv6_ra_mode": null,                                                 
      "allocation_pools": [                                                 
        {                                                                   
          "start": "14.14.14.111",                                          
          "end": "14.14.14.200"                                             
        }                                                                   
      ],                                                                    
      "host_routes": [],                                                    
      "ip_version": 4,                                                      
      "ipv6_address_mode": null,                                            
      "cidr": "14.14.14.0/24",                                              
      "id": "38cc31ff-2a19-4098-89f9-7278ed532df8",                         
      "subnetpool_id": null                                                 
    }                                                                       
  ]                                                                         
}   
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment