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