

def _cmp_sg_rule(self, exprule, retrule):
    self.assertEqual(exprule['id'], retrule.id)
    self.assertEqual(exprule['security_group_id'], retrule.parent_group_id)
    self.assertEqual(exprule['direction'], retrule.direction)
    self.assertEqual(exprule['ethertype'], retrule.ethertype)
    self.assertEqual(exprule['port_range_min'], retrule.from_port)
    self.assertEqual(exprule['port_range_max'], retrule.to_port)
    if ((exprule['remote_ip_prefix'] is None) and (exprule['remote_group_id'] is None)):
        expcidr = ('::/0' if (exprule['ethertype'] == 'IPv6') else '0.0.0.0/0')
    else:
        expcidr = exprule['remote_ip_prefix']
    self.assertEqual(expcidr, retrule.ip_range.get('cidr'))
    self.assertEqual(self.sg_dict.get(exprule['remote_group_id']), retrule.group.get('name'))

dataset/ETHPy150Open CiscoSystems/avos/openstack_dashboard/test/api_tests/network_tests.py NetworkApiNeutronSecurityGroupTests._cmp_sg_rule/original