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

     1  package testing
     2  
     3  import (
     4  	"time"
     5  
     6  	"github.com/gophercloud/gophercloud/openstack/networking/v2/extensions/agents"
     7  )
     8  
     9  // AgentsListResult represents raw response for the List request.
    10  const AgentsListResult = `
    11  {
    12      "agents": [
    13          {
    14              "admin_state_up": true,
    15              "agent_type": "Open vSwitch agent",
    16              "alive": true,
    17              "availability_zone": null,
    18              "binary": "neutron-openvswitch-agent",
    19              "configurations": {
    20                  "datapath_type": "system",
    21                  "extensions": [
    22                      "qos"
    23                  ]
    24              },
    25              "created_at": "2017-07-26 23:15:44",
    26              "description": null,
    27              "heartbeat_timestamp": "2019-01-09 10:28:53",
    28              "host": "compute1",
    29              "id": "59186d7b-b512-4fdf-bbaf-5804ffde8811",
    30              "started_at": "2018-06-26 21:46:19",
    31              "topic": "N/A"
    32          },
    33          {
    34              "admin_state_up": true,
    35              "agent_type": "Open vSwitch agent",
    36              "alive": true,
    37              "availability_zone": null,
    38              "binary": "neutron-openvswitch-agent",
    39              "configurations": {
    40                  "datapath_type": "system",
    41                  "extensions": [
    42                      "qos"
    43                  ]
    44              },
    45              "created_at": "2017-01-22 14:00:50",
    46              "description": null,
    47              "heartbeat_timestamp": "2019-01-09 10:28:50",
    48              "host": "compute2",
    49              "id": "76af7b1f-d61b-4526-94f7-d2e14e2698df",
    50              "started_at": "2018-11-06 12:09:17",
    51              "topic": "N/A"
    52          }
    53      ]
    54  }
    55  `
    56  
    57  // AgentUpdateRequest represents raw request to update an Agent.
    58  const AgentUpdateRequest = `
    59  {
    60      "agent": {
    61          "description": "My OVS agent for OpenStack",
    62          "admin_state_up": true
    63      }
    64  }
    65  `
    66  
    67  // Agent represents a sample Agent struct.
    68  var Agent = agents.Agent{
    69  	ID:              "43583cf5-472e-4dc8-af5b-6aed4c94ee3a",
    70  	AdminStateUp:    true,
    71  	AgentType:       "Open vSwitch agent",
    72  	Description:     "My OVS agent for OpenStack",
    73  	Alive:           true,
    74  	ResourcesSynced: true,
    75  	Binary:          "neutron-openvswitch-agent",
    76  	Configurations: map[string]interface{}{
    77  		"ovs_hybrid_plug":            false,
    78  		"datapath_type":              "system",
    79  		"vhostuser_socket_dir":       "/var/run/openvswitch",
    80  		"log_agent_heartbeats":       false,
    81  		"l2_population":              true,
    82  		"enable_distributed_routing": false,
    83  	},
    84  	CreatedAt:          time.Date(2017, 7, 26, 23, 2, 5, 0, time.UTC),
    85  	StartedAt:          time.Date(2018, 6, 26, 21, 46, 20, 0, time.UTC),
    86  	HeartbeatTimestamp: time.Date(2019, 1, 9, 11, 43, 01, 0, time.UTC),
    87  	Host:               "compute3",
    88  	Topic:              "N/A",
    89  }
    90  
    91  // Agent1 represents first unmarshalled address scope from the
    92  // AgentsListResult.
    93  var Agent1 = agents.Agent{
    94  	ID:           "59186d7b-b512-4fdf-bbaf-5804ffde8811",
    95  	AdminStateUp: true,
    96  	AgentType:    "Open vSwitch agent",
    97  	Alive:        true,
    98  	Binary:       "neutron-openvswitch-agent",
    99  	Configurations: map[string]interface{}{
   100  		"datapath_type": "system",
   101  		"extensions": []interface{}{
   102  			"qos",
   103  		},
   104  	},
   105  	CreatedAt:          time.Date(2017, 7, 26, 23, 15, 44, 0, time.UTC),
   106  	StartedAt:          time.Date(2018, 6, 26, 21, 46, 19, 0, time.UTC),
   107  	HeartbeatTimestamp: time.Date(2019, 1, 9, 10, 28, 53, 0, time.UTC),
   108  	Host:               "compute1",
   109  	Topic:              "N/A",
   110  }
   111  
   112  // Agent2 represents second unmarshalled address scope from the
   113  // AgentsListResult.
   114  var Agent2 = agents.Agent{
   115  	ID:           "76af7b1f-d61b-4526-94f7-d2e14e2698df",
   116  	AdminStateUp: true,
   117  	AgentType:    "Open vSwitch agent",
   118  	Alive:        true,
   119  	Binary:       "neutron-openvswitch-agent",
   120  	Configurations: map[string]interface{}{
   121  		"datapath_type": "system",
   122  		"extensions": []interface{}{
   123  			"qos",
   124  		},
   125  	},
   126  	CreatedAt:          time.Date(2017, 1, 22, 14, 00, 50, 0, time.UTC),
   127  	StartedAt:          time.Date(2018, 11, 6, 12, 9, 17, 0, time.UTC),
   128  	HeartbeatTimestamp: time.Date(2019, 1, 9, 10, 28, 50, 0, time.UTC),
   129  	Host:               "compute2",
   130  	Topic:              "N/A",
   131  }
   132  
   133  // AgentsGetResult represents raw response for the Get request.
   134  const AgentsGetResult = `
   135  {
   136      "agent": {
   137          "binary": "neutron-openvswitch-agent",
   138          "description": null,
   139          "availability_zone": null,
   140          "heartbeat_timestamp": "2019-01-09 11:43:01",
   141          "admin_state_up": true,
   142          "alive": true,
   143          "id": "43583cf5-472e-4dc8-af5b-6aed4c94ee3a",
   144          "topic": "N/A",
   145          "host": "compute3",
   146          "agent_type": "Open vSwitch agent",
   147          "started_at": "2018-06-26 21:46:20",
   148          "created_at": "2017-07-26 23:02:05",
   149          "configurations": {
   150              "ovs_hybrid_plug": false,
   151              "datapath_type": "system",
   152              "vhostuser_socket_dir": "/var/run/openvswitch",
   153              "log_agent_heartbeats": false,
   154              "l2_population": true,
   155              "enable_distributed_routing": false
   156          }
   157      }
   158  }
   159  `
   160  
   161  // AgentsUpdateResult represents raw response for the Update request.
   162  const AgentsUpdateResult = `
   163  {
   164      "agent": {
   165          "binary": "neutron-openvswitch-agent",
   166          "description": "My OVS agent for OpenStack",
   167          "availability_zone": null,
   168          "heartbeat_timestamp": "2019-01-09 11:43:01",
   169          "admin_state_up": true,
   170          "alive": true,
   171          "id": "43583cf5-472e-4dc8-af5b-6aed4c94ee3a",
   172          "topic": "N/A",
   173          "host": "compute3",
   174          "agent_type": "Open vSwitch agent",
   175          "started_at": "2018-06-26 21:46:20",
   176          "created_at": "2017-07-26 23:02:05",
   177  	"resources_synced": true,
   178          "configurations": {
   179              "ovs_hybrid_plug": false,
   180              "datapath_type": "system",
   181              "vhostuser_socket_dir": "/var/run/openvswitch",
   182              "log_agent_heartbeats": false,
   183              "l2_population": true,
   184              "enable_distributed_routing": false
   185          }
   186      }
   187  }
   188  `
   189  
   190  // AgentDHCPNetworksListResult represents raw response for the ListDHCPNetworks request.
   191  const AgentDHCPNetworksListResult = `
   192  {
   193      "networks": [
   194          {
   195              "admin_state_up": true,
   196              "availability_zone_hints": [],
   197              "availability_zones": [
   198                  "nova"
   199              ],
   200              "created_at": "2016-03-08T20:19:41",
   201              "dns_domain": "my-domain.org.",
   202              "id": "d32019d3-bc6e-4319-9c1d-6722fc136a22",
   203              "ipv4_address_scope": null,
   204              "ipv6_address_scope": null,
   205              "l2_adjacency": false,
   206              "mtu": 1500,
   207              "name": "net1",
   208              "port_security_enabled": true,
   209              "project_id": "4fd44f30292945e481c7b8a0c8908869",
   210              "qos_policy_id": "6a8454ade84346f59e8d40665f878b2e",
   211              "revision_number": 1,
   212              "router:external": false,
   213              "shared": false,
   214              "status": "ACTIVE",
   215              "subnets": [
   216                  "54d6f61d-db07-451c-9ab3-b9609b6b6f0b"
   217              ],
   218              "tenant_id": "4fd44f30292945e481c7b8a0c8908869",
   219              "updated_at": "2016-03-08T20:19:41",
   220              "vlan_transparent": true,
   221              "description": "",
   222              "is_default": false
   223          }
   224      ]
   225  }
   226  `
   227  
   228  // ScheduleDHCPNetworkRequest represents raw request for the ScheduleDHCPNetwork request.
   229  const ScheduleDHCPNetworkRequest = `
   230  {
   231      "network_id": "1ae075ca-708b-4e66-b4a7-b7698632f05f"
   232  }
   233  `
   234  
   235  const ListBGPSpeakersResult = `
   236  {
   237    "bgp_speakers": [
   238      {
   239        "peers": [
   240          "cc4e1b15-e8b1-415e-b39a-3b087ed567b4",
   241          "4022d79f-835e-4271-b5d1-d90dce5662df"
   242        ],
   243        "project_id": "89f56d77-fee7-4b2f-8b1e-583717a93690",
   244        "name": "gophercloud-testing-speaker",
   245        "tenant_id": "5c372f0b-051e-485c-a82c-9dd732e7df83",
   246        "local_as": 12345,
   247        "advertise_tenant_networks": true,
   248        "networks": [
   249          "932d70b1-db21-4542-b520-d5e73ddee407"
   250        ],
   251        "ip_version": 4,
   252        "advertise_floating_ip_host_routes": true,
   253        "id": "cab00464-284d-4251-9798-2b27db7b1668"
   254      }
   255    ]
   256  }
   257  `
   258  const ScheduleBGPSpeakerRequest = `
   259  {
   260      "bgp_speaker_id": "8edb2c68-0654-49a9-b3fe-030f92e3ddf6"
   261  }
   262  `
   263  
   264  var BGPAgent1 = agents.Agent{
   265  	ID:           "60d78b78-b56b-4d91-a174-2c03159f6bb6",
   266  	AdminStateUp: true,
   267  	AgentType:    "BGP dynamic routing agent",
   268  	Alive:        true,
   269  	Binary:       "neutron-bgp-dragent",
   270  	Configurations: map[string]interface{}{
   271  		"advertise_routes": float64(2),
   272  		"bgp_peers":        float64(2),
   273  		"bgp_speakers":     float64(1),
   274  	},
   275  	CreatedAt:          time.Date(2020, 9, 17, 20, 8, 58, 0, time.UTC),
   276  	StartedAt:          time.Date(2021, 5, 4, 11, 13, 12, 0, time.UTC),
   277  	HeartbeatTimestamp: time.Date(2021, 9, 13, 19, 55, 1, 0, time.UTC),
   278  	Host:               "agent1.example.com",
   279  	Topic:              "bgp_dragent",
   280  }
   281  
   282  var BGPAgent2 = agents.Agent{
   283  	ID:           "d0bdcea2-1d02-4c1d-9e79-b827e77acc22",
   284  	AdminStateUp: true,
   285  	AgentType:    "BGP dynamic routing agent",
   286  	Alive:        true,
   287  	Binary:       "neutron-bgp-dragent",
   288  	Configurations: map[string]interface{}{
   289  		"advertise_routes": float64(2),
   290  		"bgp_peers":        float64(2),
   291  		"bgp_speakers":     float64(1),
   292  	},
   293  	CreatedAt:          time.Date(2020, 9, 17, 20, 8, 15, 0, time.UTC),
   294  	StartedAt:          time.Date(2021, 5, 4, 11, 13, 13, 0, time.UTC),
   295  	HeartbeatTimestamp: time.Date(2021, 9, 13, 19, 54, 47, 0, time.UTC),
   296  	Host:               "agent2.example.com",
   297  	Topic:              "bgp_dragent",
   298  }
   299  
   300  const ListDRAgentHostingBGPSpeakersResult = `
   301  {
   302    "agents": [
   303      {
   304        "binary": "neutron-bgp-dragent",
   305        "description": null,
   306        "availability_zone": null,
   307        "heartbeat_timestamp": "2021-09-13 19:55:01",
   308        "admin_state_up": true,
   309        "resources_synced": null,
   310        "alive": true,
   311        "topic": "bgp_dragent",
   312        "host": "agent1.example.com",
   313        "agent_type": "BGP dynamic routing agent",
   314        "resource_versions": {},
   315        "created_at": "2020-09-17 20:08:58",
   316        "started_at": "2021-05-04 11:13:12",
   317        "id": "60d78b78-b56b-4d91-a174-2c03159f6bb6",
   318        "configurations": {
   319          "advertise_routes": 2,
   320          "bgp_peers": 2,
   321          "bgp_speakers": 1
   322        }
   323      },
   324      {
   325        "binary": "neutron-bgp-dragent",
   326        "description": null,
   327        "availability_zone": null,
   328        "heartbeat_timestamp": "2021-09-13 19:54:47",
   329        "admin_state_up": true,
   330        "resources_synced": null,
   331        "alive": true,
   332        "topic": "bgp_dragent",
   333        "host": "agent2.example.com",
   334        "agent_type": "BGP dynamic routing agent",
   335        "resource_versions": {},
   336        "created_at": "2020-09-17 20:08:15",
   337        "started_at": "2021-05-04 11:13:13",
   338        "id": "d0bdcea2-1d02-4c1d-9e79-b827e77acc22",
   339        "configurations": {
   340          "advertise_routes": 2,
   341          "bgp_peers": 2,
   342          "bgp_speakers": 1
   343        }
   344      }
   345    ]
   346  }
   347  `
   348  
   349  // AgentL3ListListResult represents raw response for the ListL3Routers request.
   350  const AgentL3RoutersListResult = `
   351  {
   352      "routers": [
   353          {
   354              "admin_state_up": true,
   355              "availability_zone_hints": [],
   356              "availability_zones": [
   357                  "nova"
   358              ],
   359              "description": "",
   360              "distributed": false,
   361              "external_gateway_info": {
   362                  "enable_snat": true,
   363                  "external_fixed_ips": [
   364                      {
   365                          "ip_address": "172.24.4.3",
   366                          "subnet_id": "b930d7f6-ceb7-40a0-8b81-a425dd994ccf"
   367                      },
   368                      {
   369                          "ip_address": "2001:db8::c",
   370                          "subnet_id": "0c56df5d-ace5-46c8-8f4c-45fa4e334d18"
   371                      }
   372                  ],
   373                  "network_id": "ae34051f-aa6c-4c75-abf5-50dc9ac99ef3"
   374              },
   375              "flavor_id": "f7b14d9a-b0dc-4fbe-bb14-a0f4970a69e0",
   376              "ha": false,
   377              "id": "915a14a6-867b-4af7-83d1-70efceb146f9",
   378              "name": "router2",
   379              "revision_number": 1,
   380              "routes": [
   381                  {
   382                      "destination": "179.24.1.0/24",
   383                      "nexthop": "172.24.3.99"
   384                  }
   385              ],
   386              "status": "ACTIVE",
   387              "project_id": "0bd18306d801447bb457a46252d82d13",
   388              "tenant_id": "0bd18306d801447bb457a46252d82d13",
   389              "service_type_id": null
   390          },
   391          {
   392              "admin_state_up": true,
   393              "availability_zone_hints": [],
   394              "availability_zones": [
   395                  "nova"
   396              ],
   397              "description": "",
   398              "distributed": false,
   399              "external_gateway_info": {
   400                  "enable_snat": true,
   401                  "external_fixed_ips": [
   402                      {
   403                          "ip_address": "172.24.4.6",
   404                          "subnet_id": "b930d7f6-ceb7-40a0-8b81-a425dd994ccf"
   405                      },
   406                      {
   407                          "ip_address": "2001:db8::9",
   408                          "subnet_id": "0c56df5d-ace5-46c8-8f4c-45fa4e334d18"
   409                      }
   410                  ],
   411                  "network_id": "ae34051f-aa6c-4c75-abf5-50dc9ac99ef3"
   412              },
   413              "flavor_id": "f7b14d9a-b0dc-4fbe-bb14-a0f4970a69e0",
   414              "ha": false,
   415              "id": "f8a44de0-fc8e-45df-93c7-f79bf3b01c95",
   416              "name": "router1",
   417              "revision_number": 1,
   418              "routes": [],
   419              "status": "ACTIVE",
   420              "project_id": "0bd18306d801447bb457a46252d82d13",
   421              "tenant_id": "0bd18306d801447bb457a46252d82d13",
   422              "service_type_id": null
   423          }
   424      ]
   425  }
   426  `
   427  
   428  // ScheduleL3RouterRequest represents raw request for the ScheduleL3Router request.
   429  const ScheduleL3RouterRequest = `
   430  {
   431      "router_id": "43e66290-79a4-415d-9eb9-7ff7919839e1"
   432  }
   433  `