Adding port methods

- Adding port config values
- Adding port constants
- Adding a port behavior method

Change-Id: Ibcb26557823eaf3ac625676da4d35f0492808c3a
This commit is contained in:
Leonardo Maycotte 2014-11-06 16:29:15 -06:00
parent 3705aa9f9d
commit 0e7b478d4e
3 changed files with 36 additions and 2 deletions

View File

@ -55,4 +55,5 @@ class NeutronErrorTypes(object):
OVERLAPPING_ALLOCATION_POOLS = 'OverlappingAllocationPools'
OVER_QUOTA = 'OverQuota'
POLICY_NOT_AUTHORIZED = 'PolicyNotAuthorized'
PORT_NOT_FOUND = 'PortNotFound'
SECURITY_GROUPS_NOT_IMPLEMENTED = 'SecurityGroupsNotImplemented'

View File

@ -13,8 +13,7 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
"""
import time
import netaddr
import time
from cloudcafe.common.tools.datagen import rand_name
@ -38,6 +37,20 @@ class PortsBehaviors(NetworkingBaseBehaviors):
self.config = ports_config
self.client = ports_client
def format_fixed_ips(self, fixed_ips):
"""
@summary: formats fixed ips for assertions removing zeros on
IPv6 addresses
@param fixed_ips: list of fixed_ips
@type fixed_ips: list(dict)
@return: formated fixed_ips
@rtype: list(dict)
"""
result = [dict(subnet_id=fixed_ip['subnet_id'], ip_address=str(
netaddr.IPAddress(fixed_ip['ip_address'])))
for fixed_ip in fixed_ips]
return result
def create_port(self, network_id, name=None, admin_state_up=None,
mac_address=None, fixed_ips=None, device_id=None,
device_owner=None, tenant_id=None, security_groups=None,

View File

@ -26,3 +26,23 @@ class PortsConfig(NetworkingBaseConfig):
def starts_with_name(self):
"""Port start name label for test runs"""
return self.get("starts_with_name", "test_port")
@property
def multiple_ports(self):
"""Test multiple ports smoke test ports number"""
return int(self.get("multiple_ports", 10))
@property
def ports_per_network(self):
"""Ports per network quota"""
return int(self.get("ports_per_network", 250))
@property
def test_quotas(self):
"""Flag for running the ports quotas tests"""
return self.get_boolean("test_quotas", False)
@property
def fixed_ips_per_port(self):
"""Ports fixed IPs quota"""
return int(self.get("fixed_ips_per_port", 4))