GroupDescription: HTTP and SSH access
SecurityGroupIngress:
- IpProtocol: tcp
- FromPort: 22
- ToPort: 22
+ FromPort: "22"
+ ToPort: "22"
CidrIp: 0.0.0.0/0
- IpProtocol: tcp
- FromPort : 80
- ToPort : 80
+ FromPort : "80"
+ ToPort : "80"
CidrIp : 0.0.0.0/0
- IpProtocol: tcp
SourceSecurityGroupName: test
- IpProtocol: icmp
- SourceSecurityGroupId: 1
+ SourceSecurityGroupId: "1"
'''
test_template_nova_with_egress = '''
GroupDescription: HTTP and SSH access
SecurityGroupEgress:
- IpProtocol: tcp
- FromPort: 22
- ToPort: 22
+ FromPort: "22"
+ ToPort: "22"
CidrIp: 0.0.0.0/0
'''
VpcId: aaaa
SecurityGroupIngress:
- IpProtocol: tcp
- FromPort: 22
- ToPort: 22
+ FromPort: "22"
+ ToPort: "22"
CidrIp: 0.0.0.0/0
- IpProtocol: tcp
- FromPort : 80
- ToPort : 80
+ FromPort : "80"
+ ToPort : "80"
CidrIp : 0.0.0.0/0
- IpProtocol: tcp
SourceSecurityGroupId: wwww
SecurityGroupEgress:
- IpProtocol: tcp
- FromPort: 22
- ToPort: 22
+ FromPort: "22"
+ ToPort: "22"
CidrIp: 10.0.1.0/24
- SourceSecurityGroupName: xxxx
'''
clients.OpenStackClients.nova('compute').AndReturn(self.fc)
nova_sgr.SecurityGroupRuleManager.create(
- 2, 'tcp', 22, 22, '0.0.0.0/0', None).AndReturn(None)
+ 2, 'tcp', '22', '22', '0.0.0.0/0', None).AndReturn(None)
nova_sgr.SecurityGroupRuleManager.create(
- 2, 'tcp', 80, 80, '0.0.0.0/0', None).AndReturn(None)
+ 2, 'tcp', '80', '80', '0.0.0.0/0', None).AndReturn(None)
nova_sgr.SecurityGroupRuleManager.create(
2, 'tcp', None, None, None, 1).AndReturn(None)
nova_sgr.SecurityGroupRuleManager.create(
- 2, 'icmp', None, None, None, 1).AndReturn(None)
+ 2, 'icmp', None, None, None, '1').AndReturn(None)
# delete script
clients.OpenStackClients.nova('compute').AndReturn(self.fc)
name=sg_name,
description='HTTP and SSH access',
rules=[{
- "from_port": 22,
+ "from_port": '22',
"group": {},
"ip_protocol": "tcp",
- "to_port": 22,
+ "to_port": '22',
"parent_group_id": 2,
"ip_range": {
"cidr": "0.0.0.0/0"
},
'id': 130
}, {
- 'from_port': 80,
+ 'from_port': '80',
'group': {},
'ip_protocol': 'tcp',
- 'to_port': 80,
+ 'to_port': '80',
'parent_group_id': 2,
'ip_range': {
'cidr': '0.0.0.0/0'
clients.OpenStackClients.nova('compute').AndReturn(self.fc)
nova_sgr.SecurityGroupRuleManager.create(
- 2, 'tcp', 22, 22, '0.0.0.0/0', None).AndRaise(
+ 2, 'tcp', '22', '22', '0.0.0.0/0', None).AndRaise(
clients.novaclient.exceptions.BadRequest(
400, 'Rule already exists'))
nova_sgr.SecurityGroupRuleManager.create(
- 2, 'tcp', 80, 80, '0.0.0.0/0', None).AndReturn(
+ 2, 'tcp', '80', '80', '0.0.0.0/0', None).AndReturn(
clients.novaclient.exceptions.BadRequest(
400, 'Rule already exists'))
nova_sgr.SecurityGroupRuleManager.create(
clients.novaclient.exceptions.BadRequest(
400, 'Rule already exists'))
nova_sgr.SecurityGroupRuleManager.create(
- 2, 'icmp', None, None, None, 1).AndReturn(
+ 2, 'icmp', None, None, None, '1').AndReturn(
clients.novaclient.exceptions.BadRequest(
400, 'Rule already exists'))
name=sg_name,
description='HTTP and SSH access',
rules=[{
- "from_port": 22,
+ "from_port": '22',
"group": {},
"ip_protocol": "tcp",
- "to_port": 22,
+ "to_port": '22',
"parent_group_id": 2,
"ip_range": {
"cidr": "0.0.0.0/0"
},
'id': 130
}, {
- 'from_port': 80,
+ 'from_port': '80',
'group': {},
'ip_protocol': 'tcp',
- 'to_port': 80,
+ 'to_port': '80',
'parent_group_id': 2,
'ip_range': {
'cidr': '0.0.0.0/0'
'direction': 'ingress',
'remote_group_id': None,
'remote_ip_prefix': '0.0.0.0/0',
- 'port_range_min': 22,
+ 'port_range_min': '22',
'ethertype': 'IPv4',
- 'port_range_max': 22,
+ 'port_range_max': '22',
'protocol': 'tcp',
'security_group_id': 'aaaa'
}
'direction': 'ingress',
'remote_group_id': None,
'remote_ip_prefix': '0.0.0.0/0',
- 'port_range_min': 22,
+ 'port_range_min': '22',
'ethertype': 'IPv4',
- 'port_range_max': 22,
+ 'port_range_max': '22',
'protocol': 'tcp',
'security_group_id': 'aaaa',
'id': 'bbbb'
'direction': 'ingress',
'remote_group_id': None,
'remote_ip_prefix': '0.0.0.0/0',
- 'port_range_min': 80,
+ 'port_range_min': '80',
'ethertype': 'IPv4',
- 'port_range_max': 80,
+ 'port_range_max': '80',
'protocol': 'tcp',
'security_group_id': 'aaaa'
}
'direction': 'ingress',
'remote_group_id': None,
'remote_ip_prefix': '0.0.0.0/0',
- 'port_range_min': 80,
+ 'port_range_min': '80',
'ethertype': 'IPv4',
- 'port_range_max': 80,
+ 'port_range_max': '80',
'protocol': 'tcp',
'security_group_id': 'aaaa',
'id': 'cccc'
'direction': 'egress',
'remote_group_id': None,
'remote_ip_prefix': '10.0.1.0/24',
- 'port_range_min': 22,
+ 'port_range_min': '22',
'ethertype': 'IPv4',
- 'port_range_max': 22,
+ 'port_range_max': '22',
'protocol': 'tcp',
'security_group_id': 'aaaa'
}
'direction': 'egress',
'remote_group_id': None,
'remote_ip_prefix': '10.0.1.0/24',
- 'port_range_min': 22,
+ 'port_range_min': '22',
'ethertype': 'IPv4',
- 'port_range_max': 22,
+ 'port_range_max': '22',
'protocol': 'tcp',
'security_group_id': 'aaaa',
'id': 'eeee'
'security_group_rules': [{
'direction': 'ingress',
'protocol': 'tcp',
- 'port_range_max': 22,
+ 'port_range_max': '22',
'id': 'bbbb',
'ethertype': 'IPv4',
'security_group_id': 'aaaa',
'remote_group_id': None,
'remote_ip_prefix': '0.0.0.0/0',
'tenant_id': 'f18ca530cc05425e8bac0a5ff92f7e88',
- 'port_range_min': 22
+ 'port_range_min': '22'
}, {
'direction': 'ingress',
'protocol': 'tcp',
- 'port_range_max': 80,
+ 'port_range_max': '80',
'id': 'cccc',
'ethertype': 'IPv4',
'security_group_id': 'aaaa',
'remote_group_id': None,
'remote_ip_prefix': '0.0.0.0/0',
'tenant_id': 'f18ca530cc05425e8bac0a5ff92f7e88',
- 'port_range_min': 80
+ 'port_range_min': '80'
}, {
'direction': 'ingress',
'protocol': 'tcp',
}, {
'direction': 'egress',
'protocol': 'tcp',
- 'port_range_max': 22,
+ 'port_range_max': '22',
'id': 'eeee',
'ethertype': 'IPv4',
'security_group_id': 'aaaa',
'remote_group_id': None,
'remote_ip_prefix': '10.0.1.0/24',
'tenant_id': 'f18ca530cc05425e8bac0a5ff92f7e88',
- 'port_range_min': 22
+ 'port_range_min': '22'
}, {
'direction': 'egress',
'protocol': None,
'direction': 'ingress',
'remote_group_id': None,
'remote_ip_prefix': '0.0.0.0/0',
- 'port_range_min': 22,
+ 'port_range_min': '22',
'ethertype': 'IPv4',
- 'port_range_max': 22,
+ 'port_range_max': '22',
'protocol': 'tcp',
'security_group_id': 'aaaa'
}
'direction': 'ingress',
'remote_group_id': None,
'remote_ip_prefix': '0.0.0.0/0',
- 'port_range_min': 80,
+ 'port_range_min': '80',
'ethertype': 'IPv4',
- 'port_range_max': 80,
+ 'port_range_max': '80',
'protocol': 'tcp',
'security_group_id': 'aaaa'
}
'direction': 'egress',
'remote_group_id': None,
'remote_ip_prefix': '10.0.1.0/24',
- 'port_range_min': 22,
+ 'port_range_min': '22',
'ethertype': 'IPv4',
- 'port_range_max': 22,
+ 'port_range_max': '22',
'protocol': 'tcp',
'security_group_id': 'aaaa'
}
'security_group_rules': [{
'direction': 'ingress',
'protocol': 'tcp',
- 'port_range_max': 22,
+ 'port_range_max': '22',
'id': 'bbbb',
'ethertype': 'IPv4',
'security_group_id': 'aaaa',
'remote_group_id': None,
'remote_ip_prefix': '0.0.0.0/0',
'tenant_id': 'f18ca530cc05425e8bac0a5ff92f7e88',
- 'port_range_min': 22
+ 'port_range_min': '22'
}, {
'direction': 'ingress',
'protocol': 'tcp',
- 'port_range_max': 80,
+ 'port_range_max': '80',
'id': 'cccc',
'ethertype': 'IPv4',
'security_group_id': 'aaaa',
'remote_group_id': None,
'remote_ip_prefix': '0.0.0.0/0',
'tenant_id': 'f18ca530cc05425e8bac0a5ff92f7e88',
- 'port_range_min': 80
+ 'port_range_min': '80'
}, {
'direction': 'ingress',
'protocol': 'tcp',
}, {
'direction': 'egress',
'protocol': 'tcp',
- 'port_range_max': 22,
+ 'port_range_max': '22',
'id': 'eeee',
'ethertype': 'IPv4',
'security_group_id': 'aaaa',
'remote_group_id': None,
'remote_ip_prefix': '10.0.1.0/24',
'tenant_id': 'f18ca530cc05425e8bac0a5ff92f7e88',
- 'port_range_min': 22
+ 'port_range_min': '22'
}, {
'direction': 'egress',
'protocol': None,