|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
namespace OpenStack\Networking\v2\Models; |
|
4
|
|
|
|
|
5
|
|
|
use OpenStack\Common\Resource\AbstractResource; |
|
6
|
|
|
use OpenStack\Common\Resource\Creatable; |
|
7
|
|
|
use OpenStack\Common\Resource\Deletable; |
|
8
|
|
|
use OpenStack\Common\Resource\Listable; |
|
9
|
|
|
use OpenStack\Common\Resource\Updateable; |
|
10
|
|
|
|
|
11
|
|
|
/** |
|
12
|
|
|
* @property \OpenStack\Networking\v2\Api $api |
|
13
|
|
|
*/ |
|
14
|
|
|
class Port extends AbstractResource implements Creatable, Updateable, Deletable, Listable |
|
15
|
|
|
{ |
|
16
|
|
|
/** |
|
17
|
|
|
* The port status. Value is ACTIVE or DOWN. |
|
18
|
|
|
* |
|
19
|
|
|
* @var string |
|
20
|
|
|
*/ |
|
21
|
|
|
public $status; |
|
22
|
|
|
|
|
23
|
|
|
|
|
24
|
|
|
/** |
|
25
|
|
|
* The port name. |
|
26
|
|
|
* |
|
27
|
|
|
* @var string |
|
28
|
|
|
*/ |
|
29
|
|
|
public $name; |
|
30
|
|
|
|
|
31
|
|
|
/** |
|
32
|
|
|
* A set of zero or more allowed address pairs. An address pair consists of an IP address and MAC address. |
|
33
|
|
|
* |
|
34
|
|
|
* @var []string |
|
35
|
|
|
*/ |
|
36
|
|
|
public $allowedAddressPairs; |
|
37
|
|
|
|
|
38
|
|
|
/** |
|
39
|
|
|
* The administrative state of the port, which is up (true) or down (false). |
|
40
|
|
|
* |
|
41
|
|
|
* @var bool |
|
42
|
|
|
*/ |
|
43
|
|
|
public $adminStateUp; |
|
44
|
|
|
|
|
45
|
|
|
/** |
|
46
|
|
|
* The UUID of the attached network. |
|
47
|
|
|
* |
|
48
|
|
|
* @var string |
|
49
|
|
|
*/ |
|
50
|
|
|
public $networkId; |
|
51
|
|
|
|
|
52
|
|
|
/** |
|
53
|
|
|
* The UUID of the tenant who owns the network. Only administrative users can specify a tenant UUID other than |
|
54
|
|
|
* their own. |
|
55
|
|
|
* |
|
56
|
|
|
* @var string |
|
57
|
|
|
*/ |
|
58
|
|
|
public $tenantId; |
|
59
|
|
|
|
|
60
|
|
|
/** |
|
61
|
|
|
* A set of zero or more extra DHCP option pairs. An option pair consists of an option value and name. |
|
62
|
|
|
* |
|
63
|
|
|
* @var array |
|
64
|
|
|
*/ |
|
65
|
|
|
public $extraDhcpOpts; |
|
66
|
|
|
|
|
67
|
|
|
/** |
|
68
|
|
|
* The UUID of the entity that uses this port. For example, a DHCP agent. |
|
69
|
|
|
* |
|
70
|
|
|
* @var string |
|
71
|
|
|
*/ |
|
72
|
|
|
public $deviceOwner; |
|
73
|
|
|
|
|
74
|
|
|
/** |
|
75
|
|
|
* The MAC address of the port. |
|
76
|
|
|
* |
|
77
|
|
|
* @var string |
|
78
|
|
|
*/ |
|
79
|
|
|
public $macAddress; |
|
80
|
|
|
|
|
81
|
|
|
/** |
|
82
|
|
|
* The IP addresses for the port. Includes the IP address and UUID of the subnet. |
|
83
|
|
|
* |
|
84
|
|
|
* @var array |
|
85
|
|
|
*/ |
|
86
|
|
|
public $fixedIps; |
|
87
|
|
|
|
|
88
|
|
|
/** |
|
89
|
|
|
* The UUID of the port. |
|
90
|
|
|
* |
|
91
|
|
|
* @var string |
|
92
|
|
|
*/ |
|
93
|
|
|
public $id; |
|
94
|
|
|
|
|
95
|
|
|
/** |
|
96
|
|
|
* The UUIDs of any attached security groups. |
|
97
|
|
|
* |
|
98
|
|
|
* @var array |
|
99
|
|
|
*/ |
|
100
|
|
|
public $securityGroups; |
|
101
|
|
|
|
|
102
|
|
|
/** |
|
103
|
|
|
* The UUID of the device that uses this port. For example, a virtual server. |
|
104
|
|
|
* |
|
105
|
|
|
* @var string |
|
106
|
|
|
*/ |
|
107
|
|
|
public $deviceId; |
|
108
|
|
|
|
|
109
|
|
|
/** |
|
110
|
|
|
* The port security status. The status is enabled (true) or disabled (false). |
|
111
|
|
|
* |
|
112
|
|
|
* @var bool |
|
113
|
|
|
*/ |
|
114
|
|
|
public $portSecurityEnabled; |
|
115
|
|
|
|
|
116
|
|
|
protected $resourceKey = 'port'; |
|
117
|
|
|
|
|
118
|
|
|
/** |
|
119
|
|
|
* {@inheritDoc} |
|
120
|
|
|
*/ |
|
121
|
1 |
|
public function create(array $userOptions) |
|
122
|
|
|
{ |
|
123
|
1 |
|
$response = $this->execute($this->api->postSinglePort(), $userOptions); |
|
124
|
1 |
|
return $this->populateFromResponse($response); |
|
125
|
|
|
} |
|
126
|
|
|
|
|
127
|
1 |
|
public function bulkCreate(array $userOptions) |
|
128
|
|
|
{ |
|
129
|
1 |
|
$response = $this->execute($this->api->postMultiplePorts(), ['ports' => $userOptions]); |
|
130
|
1 |
|
return $this->extractMultipleInstances($response); |
|
131
|
|
|
} |
|
132
|
|
|
|
|
133
|
1 |
|
public function update() |
|
134
|
|
|
{ |
|
135
|
1 |
|
$this->executeWithState($this->api->putPort()); |
|
136
|
1 |
|
} |
|
137
|
|
|
|
|
138
|
1 |
|
public function delete() |
|
139
|
|
|
{ |
|
140
|
1 |
|
$this->executeWithState($this->api->deletePort()); |
|
141
|
|
|
} |
|
142
|
|
|
} |