github.com/gophercloud/gophercloud@v1.11.0/openstack/networking/v2/subnets/testing/fixtures_test.go (about)

     1  package testing
     2  
     3  import (
     4  	"github.com/gophercloud/gophercloud/openstack/networking/v2/subnets"
     5  )
     6  
     7  const SubnetListResult = `
     8  {
     9      "subnets": [
    10          {
    11              "name": "private-subnet",
    12              "enable_dhcp": true,
    13              "network_id": "db193ab3-96e3-4cb3-8fc5-05f4296d0324",
    14              "tenant_id": "26a7980765d0414dbc1fc1f88cdb7e6e",
    15              "dns_nameservers": [],
    16              "allocation_pools": [
    17                  {
    18                      "start": "10.0.0.2",
    19                      "end": "10.0.0.254"
    20                  }
    21              ],
    22              "host_routes": [],
    23              "ip_version": 4,
    24              "gateway_ip": "10.0.0.1",
    25              "cidr": "10.0.0.0/24",
    26              "id": "08eae331-0402-425a-923c-34f7cfe39c1b"
    27          },
    28          {
    29              "name": "my_subnet",
    30              "enable_dhcp": true,
    31              "network_id": "d32019d3-bc6e-4319-9c1d-6722fc136a22",
    32              "tenant_id": "4fd44f30292945e481c7b8a0c8908869",
    33              "dns_nameservers": [],
    34              "allocation_pools": [
    35                  {
    36                      "start": "192.0.0.2",
    37                      "end": "192.255.255.254"
    38                  }
    39              ],
    40              "host_routes": [],
    41              "ip_version": 4,
    42              "gateway_ip": "192.0.0.1",
    43              "cidr": "192.0.0.0/8",
    44              "id": "54d6f61d-db07-451c-9ab3-b9609b6b6f0b"
    45          },
    46          {
    47              "name": "my_gatewayless_subnet",
    48              "enable_dhcp": true,
    49              "network_id": "d32019d3-bc6e-4319-9c1d-6722fc136a23",
    50              "tenant_id": "4fd44f30292945e481c7b8a0c8908869",
    51              "dns_nameservers": [],
    52              "allocation_pools": [
    53                  {
    54                      "start": "192.168.1.2",
    55                      "end": "192.168.1.254"
    56                  }
    57              ],
    58              "host_routes": [],
    59              "ip_version": 4,
    60              "gateway_ip": null,
    61              "cidr": "192.168.1.0/24",
    62              "id": "54d6f61d-db07-451c-9ab3-b9609b6b6f0c"
    63          },
    64          {
    65              "name": "my_subnet_with_subnetpool",
    66              "enable_dhcp": false,
    67              "network_id": "d32019d3-bc6e-4319-9c1d-6722fc136a23",
    68              "tenant_id": "4fd44f30292945e481c7b8a0c8908869",
    69              "dns_nameservers": [],
    70              "allocation_pools": [
    71                  {
    72                      "start": "10.11.12.2",
    73                      "end": "10.11.12.254"
    74                  }
    75              ],
    76              "host_routes": [],
    77              "ip_version": 4,
    78              "gateway_ip": null,
    79              "cidr": "10.11.12.0/24",
    80              "id": "38186a51-f373-4bbc-838b-6eaa1aa13eac",
    81              "subnetpool_id": "b80340c7-9960-4f67-a99c-02501656284b"
    82          }
    83      ]
    84  }
    85  `
    86  
    87  var Subnet1 = subnets.Subnet{
    88  	Name:           "private-subnet",
    89  	EnableDHCP:     true,
    90  	NetworkID:      "db193ab3-96e3-4cb3-8fc5-05f4296d0324",
    91  	TenantID:       "26a7980765d0414dbc1fc1f88cdb7e6e",
    92  	DNSNameservers: []string{},
    93  	AllocationPools: []subnets.AllocationPool{
    94  		{
    95  			Start: "10.0.0.2",
    96  			End:   "10.0.0.254",
    97  		},
    98  	},
    99  	HostRoutes: []subnets.HostRoute{},
   100  	IPVersion:  4,
   101  	GatewayIP:  "10.0.0.1",
   102  	CIDR:       "10.0.0.0/24",
   103  	ID:         "08eae331-0402-425a-923c-34f7cfe39c1b",
   104  }
   105  
   106  var Subnet2 = subnets.Subnet{
   107  	Name:           "my_subnet",
   108  	EnableDHCP:     true,
   109  	NetworkID:      "d32019d3-bc6e-4319-9c1d-6722fc136a22",
   110  	TenantID:       "4fd44f30292945e481c7b8a0c8908869",
   111  	DNSNameservers: []string{},
   112  	AllocationPools: []subnets.AllocationPool{
   113  		{
   114  			Start: "192.0.0.2",
   115  			End:   "192.255.255.254",
   116  		},
   117  	},
   118  	HostRoutes: []subnets.HostRoute{},
   119  	IPVersion:  4,
   120  	GatewayIP:  "192.0.0.1",
   121  	CIDR:       "192.0.0.0/8",
   122  	ID:         "54d6f61d-db07-451c-9ab3-b9609b6b6f0b",
   123  }
   124  
   125  var Subnet3 = subnets.Subnet{
   126  	Name:           "my_gatewayless_subnet",
   127  	EnableDHCP:     true,
   128  	NetworkID:      "d32019d3-bc6e-4319-9c1d-6722fc136a23",
   129  	TenantID:       "4fd44f30292945e481c7b8a0c8908869",
   130  	DNSNameservers: []string{},
   131  	AllocationPools: []subnets.AllocationPool{
   132  		{
   133  			Start: "192.168.1.2",
   134  			End:   "192.168.1.254",
   135  		},
   136  	},
   137  	HostRoutes: []subnets.HostRoute{},
   138  	IPVersion:  4,
   139  	GatewayIP:  "",
   140  	CIDR:       "192.168.1.0/24",
   141  	ID:         "54d6f61d-db07-451c-9ab3-b9609b6b6f0c",
   142  }
   143  
   144  var Subnet4 = subnets.Subnet{
   145  	Name:           "my_subnet_with_subnetpool",
   146  	EnableDHCP:     false,
   147  	NetworkID:      "d32019d3-bc6e-4319-9c1d-6722fc136a23",
   148  	TenantID:       "4fd44f30292945e481c7b8a0c8908869",
   149  	DNSNameservers: []string{},
   150  	AllocationPools: []subnets.AllocationPool{
   151  		{
   152  			Start: "10.11.12.2",
   153  			End:   "10.11.12.254",
   154  		},
   155  	},
   156  	HostRoutes:   []subnets.HostRoute{},
   157  	IPVersion:    4,
   158  	GatewayIP:    "",
   159  	CIDR:         "10.11.12.0/24",
   160  	ID:           "38186a51-f373-4bbc-838b-6eaa1aa13eac",
   161  	SubnetPoolID: "b80340c7-9960-4f67-a99c-02501656284b",
   162  }
   163  
   164  const SubnetGetResult = `
   165  {
   166      "subnet": {
   167          "name": "my_subnet",
   168          "enable_dhcp": true,
   169          "network_id": "d32019d3-bc6e-4319-9c1d-6722fc136a22",
   170          "tenant_id": "4fd44f30292945e481c7b8a0c8908869",
   171          "dns_nameservers": [],
   172          "allocation_pools": [
   173              {
   174                  "start": "192.0.0.2",
   175                  "end": "192.255.255.254"
   176              }
   177          ],
   178          "host_routes": [],
   179          "ip_version": 4,
   180          "gateway_ip": "192.0.0.1",
   181          "cidr": "192.0.0.0/8",
   182          "id": "54d6f61d-db07-451c-9ab3-b9609b6b6f0b",
   183          "subnetpool_id": "b80340c7-9960-4f67-a99c-02501656284b"
   184      }
   185  }
   186  `
   187  
   188  const SubnetCreateRequest = `
   189  {
   190      "subnet": {
   191          "network_id": "d32019d3-bc6e-4319-9c1d-6722fc136a22",
   192          "ip_version": 4,
   193          "gateway_ip": "192.168.199.1",
   194          "cidr": "192.168.199.0/24",
   195          "dns_nameservers": ["foo"],
   196          "service_types": ["network:routed"],
   197          "allocation_pools": [
   198              {
   199                  "start": "192.168.199.2",
   200                  "end": "192.168.199.254"
   201              }
   202          ],
   203          "host_routes": [{"destination":"","nexthop": "bar"}],
   204          "subnetpool_id": "b80340c7-9960-4f67-a99c-02501656284b"
   205      }
   206  }
   207  `
   208  
   209  const SubnetCreateResult = `
   210  {
   211      "subnet": {
   212          "name": "",
   213          "enable_dhcp": true,
   214          "network_id": "d32019d3-bc6e-4319-9c1d-6722fc136a22",
   215          "tenant_id": "4fd44f30292945e481c7b8a0c8908869",
   216          "dns_nameservers": ["foo"],
   217          "service_types": ["network:routed"],
   218          "allocation_pools": [
   219              {
   220                  "start": "192.168.199.2",
   221                  "end": "192.168.199.254"
   222              }
   223          ],
   224          "host_routes": [],
   225          "ip_version": 4,
   226          "gateway_ip": "192.168.199.1",
   227          "cidr": "192.168.199.0/24",
   228          "id": "3b80198d-4f7b-4f77-9ef5-774d54e17126",
   229          "subnetpool_id": "b80340c7-9960-4f67-a99c-02501656284b"
   230      }
   231  }
   232  `
   233  
   234  const SubnetCreateWithNoGatewayRequest = `
   235  {
   236      "subnet": {
   237          "network_id": "d32019d3-bc6e-4319-9c1d-6722fc136a23",
   238          "ip_version": 4,
   239          "cidr": "192.168.1.0/24",
   240          "gateway_ip": null,
   241          "allocation_pools": [
   242              {
   243                  "start": "192.168.1.2",
   244                  "end": "192.168.1.254"
   245              }
   246          ]
   247      }
   248  }
   249  `
   250  
   251  const SubnetCreateWithNoGatewayResponse = `
   252  {
   253      "subnet": {
   254          "name": "",
   255          "enable_dhcp": true,
   256          "network_id": "d32019d3-bc6e-4319-9c1d-6722fc136a23",
   257          "tenant_id": "4fd44f30292945e481c7b8a0c8908869",
   258          "allocation_pools": [
   259              {
   260                  "start": "192.168.1.2",
   261                  "end": "192.168.1.254"
   262              }
   263          ],
   264          "host_routes": [],
   265          "ip_version": 4,
   266          "gateway_ip": null,
   267          "cidr": "192.168.1.0/24",
   268          "id": "54d6f61d-db07-451c-9ab3-b9609b6b6f0c"
   269      }
   270  }
   271  `
   272  
   273  const SubnetCreateWithDefaultGatewayRequest = `
   274  {
   275      "subnet": {
   276          "network_id": "d32019d3-bc6e-4319-9c1d-6722fc136a23",
   277          "ip_version": 4,
   278          "cidr": "192.168.1.0/24",
   279          "allocation_pools": [
   280              {
   281                  "start": "192.168.1.2",
   282                  "end": "192.168.1.254"
   283              }
   284          ]
   285      }
   286  }
   287  `
   288  
   289  const SubnetCreateWithDefaultGatewayResponse = `
   290  {
   291      "subnet": {
   292          "name": "",
   293          "enable_dhcp": true,
   294          "network_id": "d32019d3-bc6e-4319-9c1d-6722fc136a23",
   295          "tenant_id": "4fd44f30292945e481c7b8a0c8908869",
   296          "allocation_pools": [
   297              {
   298                  "start": "192.168.1.2",
   299                  "end": "192.168.1.254"
   300              }
   301          ],
   302          "host_routes": [],
   303          "ip_version": 4,
   304          "gateway_ip": "192.168.1.1",
   305          "cidr": "192.168.1.0/24",
   306          "id": "54d6f61d-db07-451c-9ab3-b9609b6b6f0c"
   307      }
   308  }
   309  `
   310  const SubnetCreateWithIPv6RaAddressModeRequest = `
   311  {
   312      "subnet": {
   313          "network_id": "d32019d3-bc6e-4319-9c1d-6722fc136a22",
   314          "ip_version": 6,
   315          "gateway_ip": "2001:db8:0:a::1",
   316          "cidr": "2001:db8:0:a:0:0:0:0/64",
   317          "ipv6_address_mode": "slaac",
   318          "ipv6_ra_mode": "slaac"
   319      }
   320  }
   321  `
   322  const SubnetCreateWithIPv6RaAddressModeResponse = `
   323  {
   324      "subnet": {
   325          "name": "",
   326          "enable_dhcp": true,
   327          "network_id": "d32019d3-bc6e-4319-9c1d-6722fc136a22",
   328          "tenant_id": "4fd44f30292945e481c7b8a0c8908869",
   329          "dns_nameservers": [],
   330          "host_routes": [],
   331          "ip_version": 6,
   332          "gateway_ip": "2001:db8:0:a::1",
   333          "cidr": "2001:db8:0:a:0:0:0:0/64",
   334          "id": "3b80198d-4f7b-4f77-9ef5-774d54e17126",
   335          "ipv6_address_mode": "slaac",
   336          "ipv6_ra_mode": "slaac"
   337      }
   338  }
   339  `
   340  
   341  const SubnetCreateRequestWithNoCIDR = `
   342  {
   343      "subnet": {
   344          "network_id": "d32019d3-bc6e-4319-9c1d-6722fc136a22",
   345          "ip_version": 4,
   346          "dns_nameservers": ["foo"],
   347          "host_routes": [{"destination":"","nexthop": "bar"}],
   348          "subnetpool_id": "b80340c7-9960-4f67-a99c-02501656284b"
   349      }
   350  }
   351  `
   352  
   353  const SubnetCreateRequestWithPrefixlen = `
   354  {
   355      "subnet": {
   356          "network_id": "d32019d3-bc6e-4319-9c1d-6722fc136a22",
   357          "ip_version": 4,
   358          "dns_nameservers": ["foo"],
   359          "host_routes": [{"destination":"","nexthop": "bar"}],
   360          "subnetpool_id": "b80340c7-9960-4f67-a99c-02501656284b",
   361          "prefixlen": 12
   362      }
   363  }
   364  `
   365  
   366  const SubnetUpdateRequest = `
   367  {
   368      "subnet": {
   369          "name": "my_new_subnet",
   370          "dns_nameservers": ["foo"],
   371          "host_routes": [{"destination":"","nexthop": "bar"}]
   372      }
   373  }
   374  `
   375  
   376  const SubnetUpdateResponse = `
   377  {
   378      "subnet": {
   379          "name": "my_new_subnet",
   380          "enable_dhcp": true,
   381          "network_id": "db193ab3-96e3-4cb3-8fc5-05f4296d0324",
   382          "tenant_id": "26a7980765d0414dbc1fc1f88cdb7e6e",
   383          "dns_nameservers": [],
   384          "allocation_pools": [
   385              {
   386                  "start": "10.0.0.2",
   387                  "end": "10.0.0.254"
   388              }
   389          ],
   390          "host_routes": [],
   391          "ip_version": 4,
   392          "gateway_ip": "10.0.0.1",
   393          "cidr": "10.0.0.0/24",
   394          "id": "08eae331-0402-425a-923c-34f7cfe39c1b"
   395      }
   396  }
   397  `
   398  
   399  const SubnetUpdateGatewayRequest = `
   400  {
   401      "subnet": {
   402          "name": "my_new_subnet",
   403          "gateway_ip": "10.0.0.1"
   404      }
   405  }
   406  `
   407  
   408  const SubnetUpdateGatewayResponse = `
   409  {
   410      "subnet": {
   411          "name": "my_new_subnet",
   412          "enable_dhcp": true,
   413          "network_id": "db193ab3-96e3-4cb3-8fc5-05f4296d0324",
   414          "tenant_id": "26a7980765d0414dbc1fc1f88cdb7e6e",
   415          "dns_nameservers": [],
   416          "allocation_pools": [
   417              {
   418                  "start": "10.0.0.2",
   419                  "end": "10.0.0.254"
   420              }
   421          ],
   422          "host_routes": [],
   423          "ip_version": 4,
   424          "gateway_ip": "10.0.0.1",
   425          "cidr": "10.0.0.0/24",
   426          "id": "08eae331-0402-425a-923c-34f7cfe39c1b"
   427      }
   428  }
   429  `
   430  
   431  const SubnetUpdateRemoveGatewayRequest = `
   432  {
   433      "subnet": {
   434          "name": "my_new_subnet",
   435          "gateway_ip": null
   436      }
   437  }
   438  `
   439  
   440  const SubnetUpdateRemoveGatewayResponse = `
   441  {
   442      "subnet": {
   443          "name": "my_new_subnet",
   444          "enable_dhcp": true,
   445          "network_id": "db193ab3-96e3-4cb3-8fc5-05f4296d0324",
   446          "tenant_id": "26a7980765d0414dbc1fc1f88cdb7e6e",
   447          "dns_nameservers": [],
   448          "allocation_pools": [
   449              {
   450                  "start": "10.0.0.2",
   451                  "end": "10.0.0.254"
   452              }
   453          ],
   454          "host_routes": [],
   455          "ip_version": 4,
   456          "gateway_ip": null,
   457          "cidr": "10.0.0.0/24",
   458          "id": "08eae331-0402-425a-923c-34f7cfe39c1b"
   459      }
   460  }
   461  `
   462  
   463  const SubnetUpdateHostRoutesRequest = `
   464  {
   465      "subnet": {
   466          "name": "my_new_subnet",
   467          "host_routes": [
   468            {
   469              "destination": "192.168.1.1/24",
   470              "nexthop": "bar"
   471            }
   472          ]
   473      }
   474  }
   475  `
   476  
   477  const SubnetUpdateHostRoutesResponse = `
   478  {
   479      "subnet": {
   480          "name": "my_new_subnet",
   481          "enable_dhcp": true,
   482          "network_id": "db193ab3-96e3-4cb3-8fc5-05f4296d0324",
   483          "tenant_id": "26a7980765d0414dbc1fc1f88cdb7e6e",
   484          "dns_nameservers": [],
   485          "allocation_pools": [
   486              {
   487                  "start": "10.0.0.2",
   488                  "end": "10.0.0.254"
   489              }
   490          ],
   491          "ip_version": 4,
   492          "gateway_ip": "10.0.0.1",
   493          "host_routes": [
   494            {
   495              "destination": "192.168.1.1/24",
   496              "nexthop": "bar"
   497            }
   498          ],
   499          "cidr": "10.0.0.0/24",
   500          "id": "08eae331-0402-425a-923c-34f7cfe39c1b"
   501      }
   502  }
   503  `
   504  
   505  const SubnetUpdateRemoveHostRoutesRequest = `
   506  {
   507      "subnet": {
   508          "host_routes": []
   509      }
   510  }
   511  `
   512  
   513  const SubnetUpdateRemoveHostRoutesResponse = `
   514  {
   515      "subnet": {
   516          "name": "my_new_subnet",
   517          "enable_dhcp": true,
   518          "network_id": "db193ab3-96e3-4cb3-8fc5-05f4296d0324",
   519          "tenant_id": "26a7980765d0414dbc1fc1f88cdb7e6e",
   520          "dns_nameservers": [],
   521          "allocation_pools": [
   522              {
   523                  "start": "10.0.0.2",
   524                  "end": "10.0.0.254"
   525              }
   526          ],
   527          "host_routes": [],
   528          "ip_version": 4,
   529          "gateway_ip": null,
   530          "cidr": "10.0.0.0/24",
   531          "id": "08eae331-0402-425a-923c-34f7cfe39c1b"
   532      }
   533  }
   534  `
   535  
   536  const SubnetUpdateAllocationPoolRequest = `
   537  {
   538      "subnet": {
   539          "name": "my_new_subnet",
   540          "allocation_pools": [
   541              {
   542                  "start": "10.1.0.2",
   543                  "end": "10.1.0.254"
   544              }
   545          ]
   546      }
   547  }
   548  `
   549  
   550  const SubnetUpdateAllocationPoolResponse = `
   551  {
   552      "subnet": {
   553          "name": "my_new_subnet",
   554          "enable_dhcp": true,
   555          "network_id": "db193ab3-96e3-4cb3-8fc5-05f4296d0324",
   556          "tenant_id": "26a7980765d0414dbc1fc1f88cdb7e6e",
   557          "dns_nameservers": [],
   558          "allocation_pools": [
   559              {
   560                  "start": "10.1.0.2",
   561                  "end": "10.1.0.254"
   562              }
   563          ],
   564          "host_routes": [],
   565          "ip_version": 4,
   566          "gateway_ip": "10.0.0.1",
   567          "cidr": "10.0.0.0/24",
   568          "id": "08eae331-0402-425a-923c-34f7cfe39c1b"
   569      }
   570  }
   571  `