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

     1  package testing
     2  
     3  import (
     4  	"github.com/huaweicloud/golangsdk/openstack/networking/v2/networks"
     5  )
     6  
     7  const ListResponse = `
     8  {
     9      "networks": [
    10          {
    11              "status": "ACTIVE",
    12              "subnets": [
    13                  "54d6f61d-db07-451c-9ab3-b9609b6b6f0b"
    14              ],
    15              "name": "public",
    16              "admin_state_up": true,
    17              "tenant_id": "4fd44f30292945e481c7b8a0c8908869",
    18              "shared": true,
    19              "id": "d32019d3-bc6e-4319-9c1d-6722fc136a22",
    20              "provider:segmentation_id": 9876543210,
    21              "provider:physical_network": null,
    22              "provider:network_type": "local",
    23              "router:external": true,
    24              "port_security_enabled": true
    25          },
    26          {
    27              "status": "ACTIVE",
    28              "subnets": [
    29                  "08eae331-0402-425a-923c-34f7cfe39c1b"
    30              ],
    31              "name": "private",
    32              "admin_state_up": true,
    33              "tenant_id": "26a7980765d0414dbc1fc1f88cdb7e6e",
    34              "shared": false,
    35              "id": "db193ab3-96e3-4cb3-8fc5-05f4296d0324",
    36              "provider:segmentation_id": 1234567890,
    37              "provider:physical_network": null,
    38              "provider:network_type": "local",
    39              "router:external": false,
    40              "port_security_enabled": false
    41          }
    42      ]
    43  }`
    44  
    45  const GetResponse = `
    46  {
    47      "network": {
    48          "status": "ACTIVE",
    49          "subnets": [
    50              "54d6f61d-db07-451c-9ab3-b9609b6b6f0b"
    51          ],
    52          "name": "public",
    53          "admin_state_up": true,
    54          "tenant_id": "4fd44f30292945e481c7b8a0c8908869",
    55          "shared": true,
    56          "id": "d32019d3-bc6e-4319-9c1d-6722fc136a22",
    57          "provider:segmentation_id": 9876543210,
    58          "provider:physical_network": null,
    59          "provider:network_type": "local",
    60          "router:external": true,
    61          "port_security_enabled": true
    62      }
    63  }`
    64  
    65  const CreateRequest = `
    66  {
    67      "network": {
    68          "name": "private",
    69          "admin_state_up": true
    70      }
    71  }`
    72  
    73  const CreateResponse = `
    74  {
    75      "network": {
    76          "status": "ACTIVE",
    77          "subnets": ["08eae331-0402-425a-923c-34f7cfe39c1b"],
    78          "name": "private",
    79          "admin_state_up": true,
    80          "tenant_id": "26a7980765d0414dbc1fc1f88cdb7e6e",
    81          "shared": false,
    82          "id": "db193ab3-96e3-4cb3-8fc5-05f4296d0324",
    83          "provider:segmentation_id": 9876543210,
    84          "provider:physical_network": null,
    85          "provider:network_type": "local"
    86      }
    87  }`
    88  
    89  const CreatePortSecurityRequest = `
    90  {
    91      "network": {
    92          "name": "private",
    93          "admin_state_up": true,
    94          "port_security_enabled": false
    95      }
    96  }`
    97  
    98  const CreatePortSecurityResponse = `
    99  {
   100      "network": {
   101          "status": "ACTIVE",
   102          "subnets": ["08eae331-0402-425a-923c-34f7cfe39c1b"],
   103          "name": "private",
   104          "admin_state_up": true,
   105          "tenant_id": "26a7980765d0414dbc1fc1f88cdb7e6e",
   106          "shared": false,
   107          "id": "db193ab3-96e3-4cb3-8fc5-05f4296d0324",
   108          "provider:segmentation_id": 9876543210,
   109          "provider:physical_network": null,
   110          "provider:network_type": "local",
   111          "port_security_enabled": false
   112      }
   113  }`
   114  
   115  const CreateOptionalFieldsRequest = `
   116  {
   117    "network": {
   118        "name": "public",
   119        "admin_state_up": true,
   120        "shared": true,
   121        "tenant_id": "12345",
   122        "availability_zone_hints": ["zone1", "zone2"]
   123    }
   124  }`
   125  
   126  const UpdateRequest = `
   127  {
   128      "network": {
   129          "name": "new_network_name",
   130          "admin_state_up": false,
   131          "shared": true
   132      }
   133  }`
   134  
   135  const UpdateResponse = `
   136  {
   137      "network": {
   138          "status": "ACTIVE",
   139          "subnets": [],
   140          "name": "new_network_name",
   141          "admin_state_up": false,
   142          "tenant_id": "4fd44f30292945e481c7b8a0c8908869",
   143          "shared": true,
   144          "id": "4e8e5957-649f-477b-9e5b-f1f75b21c03c",
   145          "provider:segmentation_id": 1234567890,
   146          "provider:physical_network": null,
   147          "provider:network_type": "local"
   148      }
   149  }`
   150  
   151  const UpdatePortSecurityRequest = `
   152  {
   153      "network": {
   154          "port_security_enabled": false
   155      }
   156  }`
   157  
   158  const UpdatePortSecurityResponse = `
   159  {
   160      "network": {
   161          "status": "ACTIVE",
   162          "subnets": ["08eae331-0402-425a-923c-34f7cfe39c1b"],
   163          "name": "private",
   164          "admin_state_up": true,
   165          "tenant_id": "26a7980765d0414dbc1fc1f88cdb7e6e",
   166          "shared": false,
   167          "id": "4e8e5957-649f-477b-9e5b-f1f75b21c03c",
   168          "provider:segmentation_id": 9876543210,
   169          "provider:physical_network": null,
   170          "provider:network_type": "local",
   171          "port_security_enabled": false
   172      }
   173  }`
   174  
   175  var Network1 = networks.Network{
   176  	Status:       "ACTIVE",
   177  	Subnets:      []string{"54d6f61d-db07-451c-9ab3-b9609b6b6f0b"},
   178  	Name:         "public",
   179  	AdminStateUp: true,
   180  	TenantID:     "4fd44f30292945e481c7b8a0c8908869",
   181  	Shared:       true,
   182  	ID:           "d32019d3-bc6e-4319-9c1d-6722fc136a22",
   183  }
   184  
   185  var Network2 = networks.Network{
   186  	Status:       "ACTIVE",
   187  	Subnets:      []string{"08eae331-0402-425a-923c-34f7cfe39c1b"},
   188  	Name:         "private",
   189  	AdminStateUp: true,
   190  	TenantID:     "26a7980765d0414dbc1fc1f88cdb7e6e",
   191  	Shared:       false,
   192  	ID:           "db193ab3-96e3-4cb3-8fc5-05f4296d0324",
   193  }
   194  
   195  var ExpectedNetworkSlice = []networks.Network{Network1, Network2}