def _create_default_security_group(context, net_driver): default_group = { "name": "default", "description": "", "group_id": DEFAULT_SG_UUID, "port_egress_rules": [], "port_ingress_rules": [ {"ethertype": "IPv4", "protocol": 1}, {"ethertype": "IPv4", "protocol": 6}, {"ethertype": "IPv4", "protocol": 17}, {"ethertype": "IPv6", "protocol": 1}, {"ethertype": "IPv6", "protocol": 6}, {"ethertype": "IPv6", "protocol": 17}, ], } net_driver.create_security_group(context, "default", **default_group) default_group["id"] = DEFAULT_SG_UUID default_group["tenant_id"] = context.tenant_id for rule in default_group.pop("port_ingress_rules"): db_api.security_group_rule_create( context, security_group_id=default_group["id"], tenant_id=context.tenant_id, direction="ingress", **rule ) db_api.security_group_create(context, **default_group)
def _create_default_security_group(context): default_group = { "name": "default", "description": "", "group_id": DEFAULT_SG_UUID, "port_egress_rules": [], "port_ingress_rules": [ { "ethertype": "IPv4", "protocol": 1 }, { "ethertype": "IPv4", "protocol": 6 }, { "ethertype": "IPv4", "protocol": 17 }, { "ethertype": "IPv6", "protocol": 1 }, { "ethertype": "IPv6", "protocol": 6 }, { "ethertype": "IPv6", "protocol": 17 }, ] } net_driver.create_security_group(context, "default", **default_group) default_group["id"] = DEFAULT_SG_UUID default_group["tenant_id"] = context.tenant_id for rule in default_group.pop("port_ingress_rules"): db_api.security_group_rule_create( context, security_group_id=default_group["id"], tenant_id=context.tenant_id, direction="ingress", **rule) db_api.security_group_create(context, **default_group)
def create_security_group(context, security_group): LOG.info("create_security_group for tenant %s" % (context.tenant_id)) group = security_group["security_group"] group_name = group.get('name', '') if group_name == "default": raise sg_ext.SecurityGroupDefaultAlreadyExists() group_id = uuidutils.generate_uuid() with context.session.begin(): group["id"] = group_id group["name"] = group_name group["tenant_id"] = context.tenant_id dbgroup = db_api.security_group_create(context, **group) return v._make_security_group_dict(dbgroup)
def create_security_group(context, security_group): LOG.info("create_security_group for tenant %s" % (context.tenant_id)) group = security_group["security_group"] _validate_security_group(group) group_name = group.get("name", "") group_id = uuidutils.generate_uuid() with context.session.begin(): group["id"] = group_id group["name"] = group_name group["tenant_id"] = context.tenant_id dbgroup = db_api.security_group_create(context, **group) return v._make_security_group_dict(dbgroup)
def create_security_group(context, security_group): LOG.info("create_security_group for tenant %s" % (context.tenant_id)) group = security_group["security_group"] _validate_security_group(group) group_name = group.get('name', '') group_id = uuidutils.generate_uuid() with context.session.begin(): group["id"] = group_id group["name"] = group_name group["tenant_id"] = context.tenant_id dbgroup = db_api.security_group_create(context, **group) return v._make_security_group_dict(dbgroup)
def create_security_group(context, security_group, net_driver): # TODO(dietz/perkins): passing in net_driver as a stopgap, # XXX DO NOT DEPLOY!! XXX see redmine #2487 LOG.info("create_security_group for tenant %s" % (context.tenant_id)) group = security_group["security_group"] group_name = group.get("name", "") if group_name == "default": raise sg_ext.SecurityGroupDefaultAlreadyExists() group_id = uuidutils.generate_uuid() with context.session.begin(): net_driver.create_security_group(context, group_name, group_id=group_id, **group) group["id"] = group_id group["name"] = group_name group["tenant_id"] = context.tenant_id dbgroup = db_api.security_group_create(context, **group) return v._make_security_group_dict(dbgroup)