Files
quark/insert_provider_subnets.py
Matt Dietz 9c44acb83e Implements provider subnets
JIRA:NCP-1580

Implements hooks for showing provider subnets, which are merely aliases
for subnets owned by provider networks. Unlike provider networks, they
are merely placeholders and will never be related in the schema to any
other object.
2015-10-23 17:41:18 -05:00

53 lines
1.9 KiB
Python

import sys
from neutron.common import config
from neutron.db import api as neutron_db_api
from oslo_config import cfg
from quark.db import models
def main():
config.init(sys.argv[1:])
if not cfg.CONF.config_file:
sys.exit(_("ERROR: Unable to find configuration file via the default"
" search paths (~/.neutron/, ~/, /etc/neutron/, /etc/) and"
" the '--config-file' option!"))
config.setup_logging()
session = neutron_db_api.get_session()
subnets = [
models.Subnet(name="public_v4",
network_id="00000000-0000-0000-0000-000000000000",
id="00000000-0000-0000-0000-000000000000",
tenant_id="rackspace",
segment_id="rackspace",
do_not_use=True,
_cidr="0.0.0.0/0"),
models.Subnet(name="public_v6",
network_id="00000000-0000-0000-0000-000000000000",
id="11111111-1111-1111-1111-111111111111",
tenant_id="rackspace",
segment_id="rackspace",
do_not_use=True,
_cidr="::/0"),
models.Subnet(name="private_v4",
network_id="11111111-1111-1111-1111-111111111111",
id="22222222-2222-2222-2222-222222222222",
tenant_id="rackspace",
segment_id="rackspace",
do_not_use=True,
_cidr="0.0.0.0/0"),
models.Subnet(name="private_v6",
network_id="11111111-1111-1111-1111-111111111111",
id="33333333-3333-3333-3333-333333333333",
tenant_id="rackspace",
segment_id="rackspace",
do_not_use=True,
_cidr="::/0")]
session.bulk_save_objects(subnets)
if __name__ == "__main__":
main()