github.com/huaweicloud/golangsdk@v0.0.0-20210831081626-d823fe11ceba/openstack/networking/v2/subnets/testing/fixtures.go (about)

     1  package testing
     2  
     3  import (
     4  	"github.com/huaweicloud/golangsdk/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          "allocation_pools": [
   197              {
   198                  "start": "192.168.199.2",
   199                  "end": "192.168.199.254"
   200              }
   201          ],
   202          "host_routes": [{"destination":"","nexthop": "bar"}],
   203          "subnetpool_id": "b80340c7-9960-4f67-a99c-02501656284b"
   204      }
   205  }
   206  `
   207  
   208  const SubnetCreateResult = `
   209  {
   210      "subnet": {
   211          "name": "",
   212          "enable_dhcp": true,
   213          "network_id": "d32019d3-bc6e-4319-9c1d-6722fc136a22",
   214          "tenant_id": "4fd44f30292945e481c7b8a0c8908869",
   215          "dns_nameservers": [],
   216          "allocation_pools": [
   217              {
   218                  "start": "192.168.199.2",
   219                  "end": "192.168.199.254"
   220              }
   221          ],
   222          "host_routes": [],
   223          "ip_version": 4,
   224          "gateway_ip": "192.168.199.1",
   225          "cidr": "192.168.199.0/24",
   226          "id": "3b80198d-4f7b-4f77-9ef5-774d54e17126",
   227          "subnetpool_id": "b80340c7-9960-4f67-a99c-02501656284b"
   228      }
   229  }
   230  `
   231  
   232  const SubnetCreateWithNoGatewayRequest = `
   233  {
   234      "subnet": {
   235          "network_id": "d32019d3-bc6e-4319-9c1d-6722fc136a23",
   236          "ip_version": 4,
   237          "cidr": "192.168.1.0/24",
   238          "gateway_ip": null,
   239          "allocation_pools": [
   240              {
   241                  "start": "192.168.1.2",
   242                  "end": "192.168.1.254"
   243              }
   244          ]
   245      }
   246  }
   247  `
   248  
   249  const SubnetCreateWithNoGatewayResponse = `
   250  {
   251      "subnet": {
   252          "name": "",
   253          "enable_dhcp": true,
   254          "network_id": "d32019d3-bc6e-4319-9c1d-6722fc136a23",
   255          "tenant_id": "4fd44f30292945e481c7b8a0c8908869",
   256          "allocation_pools": [
   257              {
   258                  "start": "192.168.1.2",
   259                  "end": "192.168.1.254"
   260              }
   261          ],
   262          "host_routes": [],
   263          "ip_version": 4,
   264          "gateway_ip": null,
   265          "cidr": "192.168.1.0/24",
   266          "id": "54d6f61d-db07-451c-9ab3-b9609b6b6f0c"
   267      }
   268  }
   269  `
   270  
   271  const SubnetCreateWithDefaultGatewayRequest = `
   272  {
   273      "subnet": {
   274          "network_id": "d32019d3-bc6e-4319-9c1d-6722fc136a23",
   275          "ip_version": 4,
   276          "cidr": "192.168.1.0/24",
   277          "allocation_pools": [
   278              {
   279                  "start": "192.168.1.2",
   280                  "end": "192.168.1.254"
   281              }
   282          ]
   283      }
   284  }
   285  `
   286  
   287  const SubnetCreateWithDefaultGatewayResponse = `
   288  {
   289      "subnet": {
   290          "name": "",
   291          "enable_dhcp": true,
   292          "network_id": "d32019d3-bc6e-4319-9c1d-6722fc136a23",
   293          "tenant_id": "4fd44f30292945e481c7b8a0c8908869",
   294          "allocation_pools": [
   295              {
   296                  "start": "192.168.1.2",
   297                  "end": "192.168.1.254"
   298              }
   299          ],
   300          "host_routes": [],
   301          "ip_version": 4,
   302          "gateway_ip": "192.168.1.1",
   303          "cidr": "192.168.1.0/24",
   304          "id": "54d6f61d-db07-451c-9ab3-b9609b6b6f0c"
   305      }
   306  }
   307  `
   308  const SubnetCreateWithIPv6RaAddressModeRequest = `
   309  {
   310      "subnet": {
   311          "network_id": "d32019d3-bc6e-4319-9c1d-6722fc136a22",
   312          "ip_version": 6,
   313          "gateway_ip": "2001:db8:0:a::1",
   314          "cidr": "2001:db8:0:a:0:0:0:0/64",
   315          "ipv6_address_mode": "slaac",
   316          "ipv6_ra_mode": "slaac"
   317      }
   318  }
   319  `
   320  const SubnetCreateWithIPv6RaAddressModeResponse = `
   321  {
   322      "subnet": {
   323          "name": "",
   324          "enable_dhcp": true,
   325          "network_id": "d32019d3-bc6e-4319-9c1d-6722fc136a22",
   326          "tenant_id": "4fd44f30292945e481c7b8a0c8908869",
   327          "dns_nameservers": [],
   328          "host_routes": [],
   329          "ip_version": 6,
   330          "gateway_ip": "2001:db8:0:a::1",
   331          "cidr": "2001:db8:0:a:0:0:0:0/64",
   332          "id": "3b80198d-4f7b-4f77-9ef5-774d54e17126",
   333          "ipv6_address_mode": "slaac",
   334          "ipv6_ra_mode": "slaac"
   335      }
   336  }
   337  `
   338  
   339  const SubnetCreateRequestWithNoCIDR = `
   340  {
   341      "subnet": {
   342          "network_id": "d32019d3-bc6e-4319-9c1d-6722fc136a22",
   343          "ip_version": 4,
   344          "dns_nameservers": ["foo"],
   345          "host_routes": [{"destination":"","nexthop": "bar"}],
   346          "subnetpool_id": "b80340c7-9960-4f67-a99c-02501656284b"
   347      }
   348  }
   349  `
   350  
   351  const SubnetUpdateRequest = `
   352  {
   353      "subnet": {
   354          "name": "my_new_subnet",
   355          "dns_nameservers": ["foo"],
   356          "host_routes": [{"destination":"","nexthop": "bar"}]
   357      }
   358  }
   359  `
   360  
   361  const SubnetUpdateResponse = `
   362  {
   363      "subnet": {
   364          "name": "my_new_subnet",
   365          "enable_dhcp": true,
   366          "network_id": "db193ab3-96e3-4cb3-8fc5-05f4296d0324",
   367          "tenant_id": "26a7980765d0414dbc1fc1f88cdb7e6e",
   368          "dns_nameservers": [],
   369          "allocation_pools": [
   370              {
   371                  "start": "10.0.0.2",
   372                  "end": "10.0.0.254"
   373              }
   374          ],
   375          "host_routes": [],
   376          "ip_version": 4,
   377          "gateway_ip": "10.0.0.1",
   378          "cidr": "10.0.0.0/24",
   379          "id": "08eae331-0402-425a-923c-34f7cfe39c1b"
   380      }
   381  }
   382  `
   383  
   384  const SubnetUpdateGatewayRequest = `
   385  {
   386      "subnet": {
   387          "name": "my_new_subnet",
   388          "gateway_ip": "10.0.0.1"
   389      }
   390  }
   391  `
   392  
   393  const SubnetUpdateGatewayResponse = `
   394  {
   395      "subnet": {
   396          "name": "my_new_subnet",
   397          "enable_dhcp": true,
   398          "network_id": "db193ab3-96e3-4cb3-8fc5-05f4296d0324",
   399          "tenant_id": "26a7980765d0414dbc1fc1f88cdb7e6e",
   400          "dns_nameservers": [],
   401          "allocation_pools": [
   402              {
   403                  "start": "10.0.0.2",
   404                  "end": "10.0.0.254"
   405              }
   406          ],
   407          "host_routes": [],
   408          "ip_version": 4,
   409          "gateway_ip": "10.0.0.1",
   410          "cidr": "10.0.0.0/24",
   411          "id": "08eae331-0402-425a-923c-34f7cfe39c1b"
   412      }
   413  }
   414  `
   415  
   416  const SubnetUpdateRemoveGatewayRequest = `
   417  {
   418      "subnet": {
   419          "name": "my_new_subnet",
   420          "gateway_ip": null
   421      }
   422  }
   423  `
   424  
   425  const SubnetUpdateRemoveGatewayResponse = `
   426  {
   427      "subnet": {
   428          "name": "my_new_subnet",
   429          "enable_dhcp": true,
   430          "network_id": "db193ab3-96e3-4cb3-8fc5-05f4296d0324",
   431          "tenant_id": "26a7980765d0414dbc1fc1f88cdb7e6e",
   432          "dns_nameservers": [],
   433          "allocation_pools": [
   434              {
   435                  "start": "10.0.0.2",
   436                  "end": "10.0.0.254"
   437              }
   438          ],
   439          "host_routes": [],
   440          "ip_version": 4,
   441          "gateway_ip": null,
   442          "cidr": "10.0.0.0/24",
   443          "id": "08eae331-0402-425a-923c-34f7cfe39c1b"
   444      }
   445  }
   446  `
   447  
   448  const SubnetUpdateHostRoutesRequest = `
   449  {
   450      "subnet": {
   451          "name": "my_new_subnet",
   452          "host_routes": [
   453            {
   454              "destination": "192.168.1.1/24",
   455              "nexthop": "bar"
   456            }
   457          ]
   458      }
   459  }
   460  `
   461  
   462  const SubnetUpdateHostRoutesResponse = `
   463  {
   464      "subnet": {
   465          "name": "my_new_subnet",
   466          "enable_dhcp": true,
   467          "network_id": "db193ab3-96e3-4cb3-8fc5-05f4296d0324",
   468          "tenant_id": "26a7980765d0414dbc1fc1f88cdb7e6e",
   469          "dns_nameservers": [],
   470          "allocation_pools": [
   471              {
   472                  "start": "10.0.0.2",
   473                  "end": "10.0.0.254"
   474              }
   475          ],
   476          "ip_version": 4,
   477          "gateway_ip": "10.0.0.1",
   478          "host_routes": [
   479            {
   480              "destination": "192.168.1.1/24",
   481              "nexthop": "bar"
   482            }
   483          ],
   484          "cidr": "10.0.0.0/24",
   485          "id": "08eae331-0402-425a-923c-34f7cfe39c1b"
   486      }
   487  }
   488  `
   489  
   490  const SubnetUpdateRemoveHostRoutesRequest = `
   491  {
   492      "subnet": {
   493          "host_routes": []
   494      }
   495  }
   496  `
   497  
   498  const SubnetUpdateRemoveHostRoutesResponse = `
   499  {
   500      "subnet": {
   501          "name": "my_new_subnet",
   502          "enable_dhcp": true,
   503          "network_id": "db193ab3-96e3-4cb3-8fc5-05f4296d0324",
   504          "tenant_id": "26a7980765d0414dbc1fc1f88cdb7e6e",
   505          "dns_nameservers": [],
   506          "allocation_pools": [
   507              {
   508                  "start": "10.0.0.2",
   509                  "end": "10.0.0.254"
   510              }
   511          ],
   512          "host_routes": [],
   513          "ip_version": 4,
   514          "gateway_ip": null,
   515          "cidr": "10.0.0.0/24",
   516          "id": "08eae331-0402-425a-923c-34f7cfe39c1b"
   517      }
   518  }
   519  `
   520  
   521  const SubnetUpdateAllocationPoolRequest = `
   522  {
   523      "subnet": {
   524          "name": "my_new_subnet",
   525          "allocation_pools": [
   526              {
   527                  "start": "10.1.0.2",
   528                  "end": "10.1.0.254"
   529              }
   530          ]
   531      }
   532  }
   533  `
   534  
   535  const SubnetUpdateAllocationPoolResponse = `
   536  {
   537      "subnet": {
   538          "name": "my_new_subnet",
   539          "enable_dhcp": true,
   540          "network_id": "db193ab3-96e3-4cb3-8fc5-05f4296d0324",
   541          "tenant_id": "26a7980765d0414dbc1fc1f88cdb7e6e",
   542          "dns_nameservers": [],
   543          "allocation_pools": [
   544              {
   545                  "start": "10.1.0.2",
   546                  "end": "10.1.0.254"
   547              }
   548          ],
   549          "host_routes": [],
   550          "ip_version": 4,
   551          "gateway_ip": "10.0.0.1",
   552          "cidr": "10.0.0.0/24",
   553          "id": "08eae331-0402-425a-923c-34f7cfe39c1b"
   554      }
   555  }
   556  `