Skip to content
This repository was archived by the owner on Aug 1, 2023. It is now read-only.

Commit 69e88e9

Browse files
author
Travis Truman
committed
Testing the allowed_address_pairs update
1 parent b02c75b commit 69e88e9

File tree

2 files changed

+9
-4
lines changed

2 files changed

+9
-4
lines changed

acceptance/openstack/networking/v2/port_test.go

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -49,12 +49,16 @@ func TestPortCRUD(t *testing.T) {
4949
Name: "new_port_name",
5050
AllowedAddressPairs: []ports.AddressPair{
5151
ports.AddressPair{IPAddress: "192.168.199.201"},
52-
},
52+
},
5353
}
5454
p, err = ports.Update(Client, portID, updateOpts).Extract()
55+
5556
th.AssertNoErr(t, err)
5657
th.AssertEquals(t, p.Name, "new_port_name")
5758

59+
updatedPort, err := ports.Get(Client, portID).Extract()
60+
th.AssertEquals(t, updatedPort.AllowedAddressPairs[0].IPAddress, "192.168.199.201")
61+
5862
// Delete port
5963
res := ports.Delete(Client, portID)
6064
th.AssertNoErr(t, res.Err)
@@ -88,8 +92,8 @@ func listPorts(t *testing.T) {
8892
th.AssertNoErr(t, err)
8993

9094
for _, p := range portList {
91-
t.Logf("Port: ID [%s] Name [%s] Status [%s] MAC addr [%s] Fixed IPs [%#v] Security groups [%#v]",
92-
p.ID, p.Name, p.Status, p.MACAddress, p.FixedIPs, p.SecurityGroups)
95+
t.Logf("Port: ID [%s] Name [%s] Status [%s] MAC addr [%s] Fixed IPs [%#v] Security groups [%#v] Allowed Address Pairs [%#v]",
96+
p.ID, p.Name, p.Status, p.MACAddress, p.FixedIPs, p.SecurityGroups, p.AllowedAddressPairs)
9397
}
9498

9599
return true, nil

openstack/networking/v2/ports/results.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ func (r commonResult) Extract() (*Port, error) {
1919
var res struct {
2020
Port *Port `json:"port"`
2121
}
22-
2322
err := mapstructure.Decode(r.Body, &res)
2423

2524
return res.Port, err
@@ -83,6 +82,8 @@ type Port struct {
8382
SecurityGroups []string `mapstructure:"security_groups" json:"security_groups"`
8483
// Identifies the device (e.g., virtual server) using this port.
8584
DeviceID string `mapstructure:"device_id" json:"device_id"`
85+
// Identies the list of IP addresses the port will recognize/accept
86+
AllowedAddressPairs []AddressPair `mapstructure:"allowed_address_pairs" json:"allowed_address_pairs"`
8687
}
8788

8889
// PortPage is the page returned by a pager when traversing over a collection

0 commit comments

Comments
 (0)