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

     1  package testing
     2  
     3  const ListResponse = `
     4  {
     5      "ports": [
     6          {
     7              "status": "ACTIVE",
     8              "binding:host_id": "devstack",
     9              "name": "",
    10              "admin_state_up": true,
    11              "network_id": "70c1db1f-b701-45bd-96e0-a313ee3430b3",
    12              "tenant_id": "",
    13              "device_owner": "network:router_gateway",
    14              "mac_address": "fa:16:3e:58:42:ed",
    15              "binding:vnic_type": "normal",
    16              "fixed_ips": [
    17                  {
    18                      "subnet_id": "008ba151-0b8c-4a67-98b5-0d2b87666062",
    19                      "ip_address": "172.24.4.2"
    20                  }
    21              ],
    22              "id": "d80b1a3b-4fc1-49f3-952e-1e2ab7081d8b",
    23              "security_groups": [],
    24              "device_id": "9ae135f4-b6e0-4dad-9e91-3c223e385824",
    25              "port_security_enabled": false
    26          }
    27      ]
    28  }
    29  `
    30  
    31  const GetResponse = `
    32  {
    33      "port": {
    34          "status": "ACTIVE",
    35          "binding:host_id": "devstack",
    36          "name": "",
    37          "allowed_address_pairs": [],
    38          "admin_state_up": true,
    39          "network_id": "a87cc70a-3e15-4acf-8205-9b711a3531b7",
    40          "tenant_id": "7e02058126cc4950b75f9970368ba177",
    41          "extra_dhcp_opts": [],
    42          "binding:vif_details": {
    43              "port_filter": true,
    44              "ovs_hybrid_plug": true
    45           },
    46          "binding:vif_type": "ovs",
    47          "device_owner": "network:router_interface",
    48          "port_security_enabled": false,
    49          "mac_address": "fa:16:3e:23:fd:d7",
    50          "binding:profile": {},
    51          "binding:vnic_type": "normal",
    52          "fixed_ips": [
    53              {
    54                  "subnet_id": "a0304c3a-4f08-4c43-88af-d796509c97d2",
    55                  "ip_address": "10.0.0.1"
    56              }
    57          ],
    58          "id": "46d4bfb9-b26e-41f3-bd2e-e6dcc1ccedb2",
    59          "security_groups": [],
    60          "device_id": "5e3898d7-11be-483e-9732-b2f5eccd2b2e"
    61      }
    62  }
    63  `
    64  
    65  const CreateRequest = `
    66  {
    67      "port": {
    68          "network_id": "a87cc70a-3e15-4acf-8205-9b711a3531b7",
    69          "name": "private-port",
    70          "admin_state_up": true,
    71          "fixed_ips": [
    72              {
    73                  "subnet_id": "a0304c3a-4f08-4c43-88af-d796509c97d2",
    74                  "ip_address": "10.0.0.2"
    75              }
    76          ],
    77          "security_groups": ["foo"],
    78          "allowed_address_pairs": [
    79            {
    80              "ip_address": "10.0.0.4",
    81              "mac_address": "fa:16:3e:c9:cb:f0"
    82            }
    83          ]
    84      }
    85  }
    86  `
    87  
    88  const CreateResponse = `
    89  {
    90      "port": {
    91          "status": "DOWN",
    92          "name": "private-port",
    93          "admin_state_up": true,
    94          "network_id": "a87cc70a-3e15-4acf-8205-9b711a3531b7",
    95          "tenant_id": "d6700c0c9ffa4f1cb322cd4a1f3906fa",
    96          "device_owner": "",
    97          "mac_address": "fa:16:3e:c9:cb:f0",
    98          "fixed_ips": [
    99              {
   100                  "subnet_id": "a0304c3a-4f08-4c43-88af-d796509c97d2",
   101                  "ip_address": "10.0.0.2"
   102              }
   103          ],
   104          "id": "65c0ee9f-d634-4522-8954-51021b570b0d",
   105          "security_groups": [
   106              "f0ac4394-7e4a-4409-9701-ba8be283dbc3"
   107          ],
   108          "allowed_address_pairs": [
   109            {
   110              "ip_address": "10.0.0.4",
   111              "mac_address": "fa:16:3e:c9:cb:f0"
   112            }
   113          ],
   114          "device_id": ""
   115      }
   116  }
   117  `
   118  
   119  const CreateOmitSecurityGroupsRequest = `
   120  {
   121      "port": {
   122          "network_id": "a87cc70a-3e15-4acf-8205-9b711a3531b7",
   123          "name": "private-port",
   124          "admin_state_up": true,
   125          "fixed_ips": [
   126            {
   127              "subnet_id": "a0304c3a-4f08-4c43-88af-d796509c97d2",
   128              "ip_address": "10.0.0.2"
   129            }
   130          ],
   131          "allowed_address_pairs": [
   132            {
   133              "ip_address": "10.0.0.4",
   134              "mac_address": "fa:16:3e:c9:cb:f0"
   135            }
   136          ]
   137      }
   138  }
   139  `
   140  
   141  const CreateWithNoSecurityGroupsRequest = `
   142  {
   143      "port": {
   144          "network_id": "a87cc70a-3e15-4acf-8205-9b711a3531b7",
   145          "name": "private-port",
   146          "admin_state_up": true,
   147          "fixed_ips": [
   148            {
   149              "subnet_id": "a0304c3a-4f08-4c43-88af-d796509c97d2",
   150              "ip_address": "10.0.0.2"
   151            }
   152          ],
   153          "security_groups": [],
   154          "allowed_address_pairs": [
   155            {
   156              "ip_address": "10.0.0.4",
   157              "mac_address": "fa:16:3e:c9:cb:f0"
   158            }
   159          ]
   160      }
   161  }
   162  `
   163  
   164  const CreateWithNoSecurityGroupsResponse = `
   165  {
   166      "port": {
   167          "status": "DOWN",
   168          "name": "private-port",
   169          "admin_state_up": true,
   170          "network_id": "a87cc70a-3e15-4acf-8205-9b711a3531b7",
   171          "tenant_id": "d6700c0c9ffa4f1cb322cd4a1f3906fa",
   172          "device_owner": "",
   173          "mac_address": "fa:16:3e:c9:cb:f0",
   174          "fixed_ips": [
   175              {
   176                  "subnet_id": "a0304c3a-4f08-4c43-88af-d796509c97d2",
   177                  "ip_address": "10.0.0.2"
   178              }
   179          ],
   180          "id": "65c0ee9f-d634-4522-8954-51021b570b0d",
   181          "allowed_address_pairs": [
   182            {
   183              "ip_address": "10.0.0.4",
   184              "mac_address": "fa:16:3e:c9:cb:f0"
   185            }
   186          ],
   187          "device_id": ""
   188      }
   189  }
   190  `
   191  
   192  const CreateOmitSecurityGroupsResponse = `
   193  {
   194      "port": {
   195          "status": "DOWN",
   196          "name": "private-port",
   197          "admin_state_up": true,
   198          "network_id": "a87cc70a-3e15-4acf-8205-9b711a3531b7",
   199          "tenant_id": "d6700c0c9ffa4f1cb322cd4a1f3906fa",
   200          "device_owner": "",
   201          "mac_address": "fa:16:3e:c9:cb:f0",
   202          "fixed_ips": [
   203              {
   204                  "subnet_id": "a0304c3a-4f08-4c43-88af-d796509c97d2",
   205                  "ip_address": "10.0.0.2"
   206              }
   207          ],
   208          "id": "65c0ee9f-d634-4522-8954-51021b570b0d",
   209          "security_groups": [
   210              "f0ac4394-7e4a-4409-9701-ba8be283dbc3"
   211          ],
   212          "allowed_address_pairs": [
   213            {
   214              "ip_address": "10.0.0.4",
   215              "mac_address": "fa:16:3e:c9:cb:f0"
   216            }
   217          ],
   218          "device_id": ""
   219      }
   220  }
   221  `
   222  
   223  const CreatePortSecurityRequest = `
   224  {
   225      "port": {
   226          "network_id": "a87cc70a-3e15-4acf-8205-9b711a3531b7",
   227          "name": "private-port",
   228          "admin_state_up": true,
   229          "fixed_ips": [
   230              {
   231                  "subnet_id": "a0304c3a-4f08-4c43-88af-d796509c97d2",
   232                  "ip_address": "10.0.0.2"
   233              }
   234          ],
   235          "security_groups": ["foo"],
   236          "allowed_address_pairs": [
   237            {
   238              "ip_address": "10.0.0.4",
   239              "mac_address": "fa:16:3e:c9:cb:f0"
   240            }
   241          ],
   242          "port_security_enabled": false
   243      }
   244  }
   245  `
   246  
   247  const CreatePortSecurityResponse = `
   248  {
   249      "port": {
   250          "status": "DOWN",
   251          "name": "private-port",
   252          "admin_state_up": true,
   253          "network_id": "a87cc70a-3e15-4acf-8205-9b711a3531b7",
   254          "tenant_id": "d6700c0c9ffa4f1cb322cd4a1f3906fa",
   255          "device_owner": "",
   256          "mac_address": "fa:16:3e:c9:cb:f0",
   257          "fixed_ips": [
   258              {
   259                  "subnet_id": "a0304c3a-4f08-4c43-88af-d796509c97d2",
   260                  "ip_address": "10.0.0.2"
   261              }
   262          ],
   263          "id": "65c0ee9f-d634-4522-8954-51021b570b0d",
   264          "security_groups": [
   265              "f0ac4394-7e4a-4409-9701-ba8be283dbc3"
   266          ],
   267          "allowed_address_pairs": [
   268            {
   269              "ip_address": "10.0.0.4",
   270              "mac_address": "fa:16:3e:c9:cb:f0"
   271            }
   272          ],
   273          "device_id": "",
   274          "port_security_enabled": false
   275      }
   276  }
   277  `
   278  
   279  const UpdateRequest = `
   280  {
   281      "port": {
   282          "name": "new_port_name",
   283          "fixed_ips": [
   284              {
   285                  "subnet_id": "a0304c3a-4f08-4c43-88af-d796509c97d2",
   286                  "ip_address": "10.0.0.3"
   287              }
   288          ],
   289          "allowed_address_pairs": [
   290            {
   291              "ip_address": "10.0.0.4",
   292              "mac_address": "fa:16:3e:c9:cb:f0"
   293            }
   294          ],
   295          "security_groups": [
   296              "f0ac4394-7e4a-4409-9701-ba8be283dbc3"
   297          ]
   298      }
   299  }
   300  `
   301  
   302  const UpdateResponse = `
   303  {
   304      "port": {
   305          "status": "DOWN",
   306          "name": "new_port_name",
   307          "admin_state_up": true,
   308          "network_id": "a87cc70a-3e15-4acf-8205-9b711a3531b7",
   309          "tenant_id": "d6700c0c9ffa4f1cb322cd4a1f3906fa",
   310          "device_owner": "",
   311          "mac_address": "fa:16:3e:c9:cb:f0",
   312          "fixed_ips": [
   313              {
   314                  "subnet_id": "a0304c3a-4f08-4c43-88af-d796509c97d2",
   315                  "ip_address": "10.0.0.3"
   316              }
   317          ],
   318          "allowed_address_pairs": [
   319            {
   320              "ip_address": "10.0.0.4",
   321              "mac_address": "fa:16:3e:c9:cb:f0"
   322            }
   323          ],
   324          "id": "65c0ee9f-d634-4522-8954-51021b570b0d",
   325          "security_groups": [
   326              "f0ac4394-7e4a-4409-9701-ba8be283dbc3"
   327          ],
   328          "device_id": ""
   329      }
   330  }
   331  `
   332  
   333  const UpdateOmitSecurityGroupsRequest = `
   334  {
   335    "port": {
   336        "name": "new_port_name",
   337        "fixed_ips": [
   338            {
   339              "subnet_id": "a0304c3a-4f08-4c43-88af-d796509c97d2",
   340              "ip_address": "10.0.0.3"
   341            }
   342          ],
   343          "allowed_address_pairs": [
   344            {
   345              "ip_address": "10.0.0.4",
   346              "mac_address": "fa:16:3e:c9:cb:f0"
   347            }
   348          ]
   349      }
   350  }
   351  `
   352  
   353  const UpdateOmitSecurityGroupsResponse = `
   354  {
   355      "port": {
   356          "status": "DOWN",
   357          "name": "new_port_name",
   358          "admin_state_up": true,
   359          "network_id": "a87cc70a-3e15-4acf-8205-9b711a3531b7",
   360          "tenant_id": "d6700c0c9ffa4f1cb322cd4a1f3906fa",
   361          "device_owner": "",
   362          "mac_address": "fa:16:3e:c9:cb:f0",
   363          "fixed_ips": [
   364              {
   365                  "subnet_id": "a0304c3a-4f08-4c43-88af-d796509c97d2",
   366                  "ip_address": "10.0.0.3"
   367              }
   368          ],
   369          "allowed_address_pairs": [
   370            {
   371              "ip_address": "10.0.0.4",
   372              "mac_address": "fa:16:3e:c9:cb:f0"
   373            }
   374          ],
   375          "id": "65c0ee9f-d634-4522-8954-51021b570b0d",
   376          "security_groups": [
   377              "f0ac4394-7e4a-4409-9701-ba8be283dbc3"
   378          ],
   379          "device_id": ""
   380      }
   381  }
   382  `
   383  
   384  const UpdatePortSecurityRequest = `
   385  {
   386      "port": {
   387          "port_security_enabled": false
   388      }
   389  }
   390  `
   391  
   392  const UpdatePortSecurityResponse = `
   393  {
   394      "port": {
   395          "status": "DOWN",
   396          "name": "private-port",
   397          "admin_state_up": true,
   398          "network_id": "a87cc70a-3e15-4acf-8205-9b711a3531b7",
   399          "tenant_id": "d6700c0c9ffa4f1cb322cd4a1f3906fa",
   400          "device_owner": "",
   401          "mac_address": "fa:16:3e:c9:cb:f0",
   402          "fixed_ips": [
   403              {
   404                  "subnet_id": "a0304c3a-4f08-4c43-88af-d796509c97d2",
   405                  "ip_address": "10.0.0.2"
   406              }
   407          ],
   408          "id": "65c0ee9f-d634-4522-8954-51021b570b0d",
   409          "security_groups": [
   410              "f0ac4394-7e4a-4409-9701-ba8be283dbc3"
   411          ],
   412          "allowed_address_pairs": [
   413            {
   414              "ip_address": "10.0.0.4",
   415              "mac_address": "fa:16:3e:c9:cb:f0"
   416            }
   417          ],
   418          "device_id": "",
   419          "port_security_enabled": false
   420      }
   421  }
   422  `
   423  
   424  const RemoveSecurityGroupRequest = `
   425  {
   426      "port": {
   427        "name": "new_port_name",
   428        "fixed_ips": [
   429          {
   430            "subnet_id": "a0304c3a-4f08-4c43-88af-d796509c97d2",
   431            "ip_address": "10.0.0.3"
   432          }
   433        ],
   434        "allowed_address_pairs": [
   435          {
   436            "ip_address": "10.0.0.4",
   437            "mac_address": "fa:16:3e:c9:cb:f0"
   438          }
   439        ],
   440        "security_groups": []
   441      }
   442  }
   443  `
   444  
   445  const RemoveSecurityGroupResponse = `
   446  {
   447      "port": {
   448          "status": "DOWN",
   449          "name": "new_port_name",
   450          "admin_state_up": true,
   451          "network_id": "a87cc70a-3e15-4acf-8205-9b711a3531b7",
   452          "tenant_id": "d6700c0c9ffa4f1cb322cd4a1f3906fa",
   453          "device_owner": "",
   454          "mac_address": "fa:16:3e:c9:cb:f0",
   455          "fixed_ips": [
   456              {
   457                  "subnet_id": "a0304c3a-4f08-4c43-88af-d796509c97d2",
   458                  "ip_address": "10.0.0.3"
   459              }
   460          ],
   461          "allowed_address_pairs": [
   462            {
   463              "ip_address": "10.0.0.4",
   464              "mac_address": "fa:16:3e:c9:cb:f0"
   465            }
   466          ],
   467          "id": "65c0ee9f-d634-4522-8954-51021b570b0d",
   468          "device_id": ""
   469      }
   470  }
   471  `
   472  
   473  const RemoveAllowedAddressPairsRequest = `
   474  {
   475      "port": {
   476        "name": "new_port_name",
   477        "fixed_ips": [
   478          {
   479            "subnet_id": "a0304c3a-4f08-4c43-88af-d796509c97d2",
   480            "ip_address": "10.0.0.3"
   481          }
   482        ],
   483        "allowed_address_pairs": [],
   484        "security_groups": [
   485          "f0ac4394-7e4a-4409-9701-ba8be283dbc3"
   486        ]
   487      }
   488  }
   489  `
   490  
   491  const RemoveAllowedAddressPairsResponse = `
   492  {
   493      "port": {
   494          "status": "DOWN",
   495          "name": "new_port_name",
   496          "admin_state_up": true,
   497          "network_id": "a87cc70a-3e15-4acf-8205-9b711a3531b7",
   498          "tenant_id": "d6700c0c9ffa4f1cb322cd4a1f3906fa",
   499          "device_owner": "",
   500          "mac_address": "fa:16:3e:c9:cb:f0",
   501          "fixed_ips": [
   502              {
   503                  "subnet_id": "a0304c3a-4f08-4c43-88af-d796509c97d2",
   504                  "ip_address": "10.0.0.3"
   505              }
   506          ],
   507          "id": "65c0ee9f-d634-4522-8954-51021b570b0d",
   508          "security_groups": [
   509              "f0ac4394-7e4a-4409-9701-ba8be283dbc3"
   510          ],
   511          "device_id": ""
   512      }
   513  }
   514  `
   515  
   516  const DontUpdateAllowedAddressPairsRequest = `
   517  {
   518      "port": {
   519          "name": "new_port_name",
   520          "fixed_ips": [
   521            {
   522              "subnet_id": "a0304c3a-4f08-4c43-88af-d796509c97d2",
   523              "ip_address": "10.0.0.3"
   524            }
   525          ],
   526          "security_groups": [
   527              "f0ac4394-7e4a-4409-9701-ba8be283dbc3"
   528          ]
   529      }
   530  }
   531  `
   532  
   533  const DontUpdateAllowedAddressPairsResponse = `
   534  {
   535      "port": {
   536          "status": "DOWN",
   537          "name": "new_port_name",
   538          "admin_state_up": true,
   539          "network_id": "a87cc70a-3e15-4acf-8205-9b711a3531b7",
   540          "tenant_id": "d6700c0c9ffa4f1cb322cd4a1f3906fa",
   541          "device_owner": "",
   542          "mac_address": "fa:16:3e:c9:cb:f0",
   543          "fixed_ips": [
   544              {
   545                  "subnet_id": "a0304c3a-4f08-4c43-88af-d796509c97d2",
   546                  "ip_address": "10.0.0.3"
   547              }
   548          ],
   549          "allowed_address_pairs": [
   550            {
   551              "ip_address": "10.0.0.4",
   552              "mac_address": "fa:16:3e:c9:cb:f0"
   553            }
   554          ],
   555          "id": "65c0ee9f-d634-4522-8954-51021b570b0d",
   556          "security_groups": [
   557              "f0ac4394-7e4a-4409-9701-ba8be283dbc3"
   558          ],
   559          "device_id": ""
   560      }
   561  }
   562  `
   563  
   564  // GetWithExtraDHCPOptsResponse represents a raw port response with extra
   565  // DHCP options.
   566  const GetWithExtraDHCPOptsResponse = `
   567  {
   568      "port": {
   569          "status": "ACTIVE",
   570          "network_id": "a87cc70a-3e15-4acf-8205-9b711a3531b7",
   571          "tenant_id": "d6700c0c9ffa4f1cb322cd4a1f3906fa",
   572          "extra_dhcp_opts": [
   573              {
   574                  "opt_name": "option1",
   575                  "opt_value": "value1",
   576                  "ip_version": "4"
   577              },
   578              {
   579                  "opt_name": "option2",
   580                  "opt_value": "value2",
   581                  "ip_version": "4"
   582              }
   583          ],
   584          "admin_state_up": true,
   585          "name": "port-with-extra-dhcp-opts",
   586          "device_owner": "",
   587          "mac_address": "fa:16:3e:c9:cb:f0",
   588          "fixed_ips": [
   589              {
   590                  "subnet_id": "a0304c3a-4f08-4c43-88af-d796509c97d2",
   591                  "ip_address": "10.0.0.4"
   592              }
   593          ],
   594          "id": "65c0ee9f-d634-4522-8954-51021b570b0d",
   595          "device_id": ""
   596      }
   597  }
   598  `
   599  
   600  // CreateWithExtraDHCPOptsRequest represents a raw port creation request
   601  // with extra DHCP options.
   602  const CreateWithExtraDHCPOptsRequest = `
   603  {
   604      "port": {
   605          "network_id": "a87cc70a-3e15-4acf-8205-9b711a3531b7",
   606          "name": "port-with-extra-dhcp-opts",
   607          "admin_state_up": true,
   608          "fixed_ips": [
   609              {
   610                  "ip_address": "10.0.0.2",
   611                  "subnet_id": "a0304c3a-4f08-4c43-88af-d796509c97d2"
   612              }
   613          ],
   614          "extra_dhcp_opts": [
   615              {
   616                  "opt_name": "option1",
   617                  "opt_value": "value1"
   618              }
   619          ]
   620      }
   621  }
   622  `
   623  
   624  // CreateWithExtraDHCPOptsResponse represents a raw port creation response
   625  // with extra DHCP options.
   626  const CreateWithExtraDHCPOptsResponse = `
   627  {
   628      "port": {
   629          "status": "DOWN",
   630          "network_id": "a87cc70a-3e15-4acf-8205-9b711a3531b7",
   631          "tenant_id": "d6700c0c9ffa4f1cb322cd4a1f3906fa",
   632          "extra_dhcp_opts": [
   633              {
   634                  "opt_name": "option1",
   635                  "opt_value": "value1",
   636                  "ip_version": "4"
   637              }
   638          ],
   639          "admin_state_up": true,
   640          "name": "port-with-extra-dhcp-opts",
   641          "device_owner": "",
   642          "mac_address": "fa:16:3e:c9:cb:f0",
   643          "fixed_ips": [
   644              {
   645                  "subnet_id": "a0304c3a-4f08-4c43-88af-d796509c97d2",
   646                  "ip_address": "10.0.0.2"
   647              }
   648          ],
   649          "id": "65c0ee9f-d634-4522-8954-51021b570b0d",
   650          "device_id": ""
   651      }
   652  }
   653  `
   654  
   655  // UpdateWithExtraDHCPOptsRequest represents a raw port update request with
   656  // extra DHCP options.
   657  const UpdateWithExtraDHCPOptsRequest = `
   658  {
   659      "port": {
   660          "name": "updated-port-with-dhcp-opts",
   661          "fixed_ips": [
   662              {
   663                  "subnet_id": "a0304c3a-4f08-4c43-88af-d796509c97d2",
   664                  "ip_address": "10.0.0.3"
   665              }
   666          ],
   667          "extra_dhcp_opts": [
   668              {
   669                  "opt_name": "option1",
   670                  "opt_value": null
   671              },
   672              {
   673                  "opt_name": "option2",
   674                  "opt_value": "value2"
   675              }
   676          ]
   677      }
   678  }
   679  `
   680  
   681  // UpdateWithExtraDHCPOptsResponse represents a raw port update response with
   682  // extra DHCP options.
   683  const UpdateWithExtraDHCPOptsResponse = `
   684  {
   685      "port": {
   686          "status": "DOWN",
   687          "network_id": "a87cc70a-3e15-4acf-8205-9b711a3531b7",
   688          "tenant_id": "d6700c0c9ffa4f1cb322cd4a1f3906fa",
   689          "extra_dhcp_opts": [
   690              {
   691                  "opt_name": "option2",
   692                  "opt_value": "value2",
   693                  "ip_version": "4"
   694              }
   695          ],
   696          "admin_state_up": true,
   697          "name": "updated-port-with-dhcp-opts",
   698          "device_owner": "",
   699          "mac_address": "fa:16:3e:c9:cb:f0",
   700          "fixed_ips": [
   701              {
   702                  "subnet_id": "a0304c3a-4f08-4c43-88af-d796509c97d2",
   703                  "ip_address": "10.0.0.3"
   704              }
   705          ],
   706          "id": "65c0ee9f-d634-4522-8954-51021b570b0d",
   707          "device_id": ""
   708      }
   709  }
   710  `