From 0b5214d247111c75f64726f119db37c32f4db93e Mon Sep 17 00:00:00 2001 From: Alvaro Arriola Date: Thu, 10 Oct 2019 16:52:29 +0200 Subject: [PATCH] Fixed aesthetics. --- initializers/aggregates.yml | 2 ++ initializers/clusters.yml | 3 +++ initializers/dcim_interfaces.yml | 12 ++++-------- initializers/ip_addresses.yml | 9 ++------- initializers/prefix_vlan_roles.yml | 2 ++ initializers/prefixes.yml | 11 ++++++++++- initializers/rirs.yml | 3 +++ initializers/tenants.yml | 1 + initializers/tenants_groups.yml | 4 ++++ initializers/virtual_machines.yml | 11 ++++++++++- initializers/virtualization_interfaces.yml | 2 -- initializers/vlans.yml | 4 +++- initializers/vrfs.yml | 4 ++++ .../{104_tenant_groups.py => 110_tenant_groups.py} | 2 +- startup_scripts/{105_tenants.py => 120_tenants.py} | 2 +- startup_scripts/{110_devices.py => 130_devices.py} | 0 .../{120_cluster_types.py => 140_cluster_types.py} | 2 +- startup_scripts/{125_rirs.py => 150_rirs.py} | 2 +- .../{130_aggregates.py => 160_aggregates.py} | 3 +-- startup_scripts/{150_clusters.py => 170_clusters.py} | 2 +- startup_scripts/{155_vrfs.py => 180_vrfs.py} | 3 +-- ...prefix_vlan_roles.py => 190_prefix_vlan_roles.py} | 2 +- .../{170_vlan_groups.py => 200_vlan_groups.py} | 2 +- startup_scripts/{180_vlans.py => 210_vlans.py} | 5 +++-- startup_scripts/{190_prefixes.py => 220_prefixes.py} | 5 +++-- ...0_virtual_machines.py => 230_virtual_machines.py} | 2 +- ...nterfaces.py => 240_virtualization_interfaces.py} | 3 +-- ...215_dcim_interfaces.py => 250_dcim_interfaces.py} | 2 +- .../{220_ip_addresses.py => 260_ip_addresses.py} | 2 +- 29 files changed, 67 insertions(+), 40 deletions(-) create mode 100644 initializers/prefix_vlan_roles.yml create mode 100644 initializers/tenants_groups.yml rename startup_scripts/{104_tenant_groups.py => 110_tenant_groups.py} (87%) rename startup_scripts/{105_tenants.py => 120_tenants.py} (95%) rename startup_scripts/{110_devices.py => 130_devices.py} (100%) rename startup_scripts/{120_cluster_types.py => 140_cluster_types.py} (88%) rename startup_scripts/{125_rirs.py => 150_rirs.py} (89%) rename startup_scripts/{130_aggregates.py => 160_aggregates.py} (95%) rename startup_scripts/{150_clusters.py => 170_clusters.py} (96%) rename startup_scripts/{155_vrfs.py => 180_vrfs.py} (96%) rename startup_scripts/{160_prefix_vlan_roles.py => 190_prefix_vlan_roles.py} (86%) rename startup_scripts/{170_vlan_groups.py => 200_vlan_groups.py} (95%) rename startup_scripts/{180_vlans.py => 210_vlans.py} (90%) rename startup_scripts/{190_prefixes.py => 220_prefixes.py} (90%) rename startup_scripts/{200_virtual_machines.py => 230_virtual_machines.py} (95%) rename startup_scripts/{210_virtualization_interfaces.py => 240_virtualization_interfaces.py} (93%) rename startup_scripts/{215_dcim_interfaces.py => 250_dcim_interfaces.py} (93%) rename startup_scripts/{220_ip_addresses.py => 260_ip_addresses.py} (97%) diff --git a/initializers/aggregates.yml b/initializers/aggregates.yml index 8e73070..3dc65e6 100644 --- a/initializers/aggregates.yml +++ b/initializers/aggregates.yml @@ -1,2 +1,4 @@ #- prefix: 10.0.0.0/16 # rir: RFC1918 +#- prefix: fd00:ccdd::/32 +# rir: RFC4193 ULA diff --git a/initializers/clusters.yml b/initializers/clusters.yml index 6eff3d0..a8dc121 100644 --- a/initializers/clusters.yml +++ b/initializers/clusters.yml @@ -1,2 +1,5 @@ #- name: cluster1 # type: Hyper-V +#- name: cluster2 +# type: Hyper-V +# site: SING 1 diff --git a/initializers/dcim_interfaces.yml b/initializers/dcim_interfaces.yml index 12ddbad..e02bf07 100644 --- a/initializers/dcim_interfaces.yml +++ b/initializers/dcim_interfaces.yml @@ -1,12 +1,8 @@ -#- device: router1 +#- device: server01 # enabled: true # form_factor: 0 -# name: router2 -#- device: 9901-2.bwi-stf.lab +# name: to-server02 +#- device: server02 # enabled: true # form_factor: 0 -# name: Loopback0 -#- device: switch1 -# enabled: true -# form_factor: 0 -# name: Vlan5 +# name: to-server01 diff --git a/initializers/ip_addresses.yml b/initializers/ip_addresses.yml index 445dd9c..7427a4a 100644 --- a/initializers/ip_addresses.yml +++ b/initializers/ip_addresses.yml @@ -1,18 +1,13 @@ - #- address: 10.1.1.1/24 -# device: router1 -# family: 4 +# device: server01 # interface: Loopback0 # status: 1 # vrf: vrf1 #- address: 10.1.1.2/24 -# device: switch1 -# family: 4 +# device: server02 # interface: Vlan5 # status: 1 #- address: 10.1.1.10/24 # description: reserved IP -# family: 4 # status: 2 # tenant: tenant1 - diff --git a/initializers/prefix_vlan_roles.yml b/initializers/prefix_vlan_roles.yml new file mode 100644 index 0000000..309acc9 --- /dev/null +++ b/initializers/prefix_vlan_roles.yml @@ -0,0 +1,2 @@ +#- name: Main Management +# slug: main-management diff --git a/initializers/prefixes.yml b/initializers/prefixes.yml index 2aeb74f..8644a9e 100644 --- a/initializers/prefixes.yml +++ b/initializers/prefixes.yml @@ -9,4 +9,13 @@ # site: AMS 2 # status: 1 # tenant: tenant2 -# vlan: vlan2 \ No newline at end of file +# vlan: vlan2 +# is_pool: true +# vrf: vrf2 +# tenant: tenant2 +#- description: ipv6 prefix1 +# prefix: fd00:ccdd:a000:1::/64 +# site: AMS 2 +# status: 1 +# tenant: tenant2 +# vlan: vlan2 diff --git a/initializers/rirs.yml b/initializers/rirs.yml index f819c40..1a0c84d 100644 --- a/initializers/rirs.yml +++ b/initializers/rirs.yml @@ -1,3 +1,6 @@ #- is_private: true # name: RFC1918 # slug: rfc1918 +#- is_private: true +# name: RFC4193 ULA +# slug: rfc4193-ula diff --git a/initializers/tenants.yml b/initializers/tenants.yml index 2af9953..86db54f 100644 --- a/initializers/tenants.yml +++ b/initializers/tenants.yml @@ -2,3 +2,4 @@ # slug: tenant1 #- name: tenant2 # slug: tenant2 +# group: Tenant Group 2 diff --git a/initializers/tenants_groups.yml b/initializers/tenants_groups.yml new file mode 100644 index 0000000..53f0ce8 --- /dev/null +++ b/initializers/tenants_groups.yml @@ -0,0 +1,4 @@ +#- name: Tenant Group 1 +# slug: tenant-group-1 +#- name: Tenant Group 2 +# slug: tenant-group-2 diff --git a/initializers/virtual_machines.yml b/initializers/virtual_machines.yml index 23536bc..8fd57ed 100644 --- a/initializers/virtual_machines.yml +++ b/initializers/virtual_machines.yml @@ -6,4 +6,13 @@ # platform: Platform 2 # status: 1 # tenant: tenant1 -# vcpus: 8 \ No newline at end of file +# vcpus: 8 +#- cluster: cluster1 +# comments: VM2 +# disk: 100 +# memory: 2048 +# name: virtual machine 2 +# platform: Platform 2 +# status: 1 +# tenant: tenant1 +# vcpus: 8 diff --git a/initializers/virtualization_interfaces.yml b/initializers/virtualization_interfaces.yml index 000613f..15a64ab 100644 --- a/initializers/virtualization_interfaces.yml +++ b/initializers/virtualization_interfaces.yml @@ -1,13 +1,11 @@ #- description: Network Interface 1 # enabled: true -# form_factor: 0 # mac_address: 00:77:77:77:77:77 # mtu: 1500 # name: Network Interface 1 # virtual_machine: virtual_machine1 #- description: Network Interface 2 # enabled: true -# form_factor: 0 # mac_address: 00:55:55:55:55:55 # mtu: 1500 # name: Network Interface 2 diff --git a/initializers/vlans.yml b/initializers/vlans.yml index 8591192..6e7353d 100644 --- a/initializers/vlans.yml +++ b/initializers/vlans.yml @@ -2,8 +2,10 @@ # site: AMS 1 # status: 1 # vid: 5 +# role: Main Management +# description: VLAN 5 for MGMT #- group: VLAN group 2 # name: vlan2 # site: AMS 1 # status: 1 -# vid: 1300 \ No newline at end of file +# vid: 1300 diff --git a/initializers/vrfs.yml b/initializers/vrfs.yml index 7d9ba85..0f3684d 100644 --- a/initializers/vrfs.yml +++ b/initializers/vrfs.yml @@ -1,5 +1,9 @@ #- enforce_unique: true # name: vrf1 # tenant: tenant1 +# description: main VRF #- enforce_unique: true # name: vrf2 +# rd: "6500:6500" +# tenant: tenant2 +# tenant_group: Tenant Group 2 diff --git a/startup_scripts/104_tenant_groups.py b/startup_scripts/110_tenant_groups.py similarity index 87% rename from startup_scripts/104_tenant_groups.py rename to startup_scripts/110_tenant_groups.py index 94c58ad..eaf75dc 100644 --- a/startup_scripts/104_tenant_groups.py +++ b/startup_scripts/110_tenant_groups.py @@ -16,4 +16,4 @@ with file.open('r') as stream: tenant_group, created = TenantGroup.objects.get_or_create(**params) if created: - print("Created Tenant Group", tenant_group.name) + print("πŸ”³ Created Tenant Group", tenant_group.name) diff --git a/startup_scripts/105_tenants.py b/startup_scripts/120_tenants.py similarity index 95% rename from startup_scripts/105_tenants.py rename to startup_scripts/120_tenants.py index 8ae8ea8..8252dc7 100644 --- a/startup_scripts/105_tenants.py +++ b/startup_scripts/120_tenants.py @@ -42,4 +42,4 @@ with file.open('r') as stream: tenant.custom_field_values.add(custom_field_value) - print("Created Tenant", tenant.name) + print("πŸ‘©β€πŸ’» Created Tenant", tenant.name) diff --git a/startup_scripts/110_devices.py b/startup_scripts/130_devices.py similarity index 100% rename from startup_scripts/110_devices.py rename to startup_scripts/130_devices.py diff --git a/startup_scripts/120_cluster_types.py b/startup_scripts/140_cluster_types.py similarity index 88% rename from startup_scripts/120_cluster_types.py rename to startup_scripts/140_cluster_types.py index 5211ea5..9bd4be1 100644 --- a/startup_scripts/120_cluster_types.py +++ b/startup_scripts/140_cluster_types.py @@ -16,4 +16,4 @@ with file.open('r') as stream: cluster_type, created = ClusterType.objects.get_or_create(**params) if created: - print("Created Cluster Type", cluster_type.name) + print("🧰 Created Cluster Type", cluster_type.name) diff --git a/startup_scripts/125_rirs.py b/startup_scripts/150_rirs.py similarity index 89% rename from startup_scripts/125_rirs.py rename to startup_scripts/150_rirs.py index d120545..9cee56f 100644 --- a/startup_scripts/125_rirs.py +++ b/startup_scripts/150_rirs.py @@ -16,4 +16,4 @@ with file.open('r') as stream: rir, created = RIR.objects.get_or_create(**params) if created: - print("Created RIR", rir.name) + print("πŸ—ΊοΈ Created RIR", rir.name) diff --git a/startup_scripts/130_aggregates.py b/startup_scripts/160_aggregates.py similarity index 95% rename from startup_scripts/130_aggregates.py rename to startup_scripts/160_aggregates.py index c82aa95..f932709 100644 --- a/startup_scripts/130_aggregates.py +++ b/startup_scripts/160_aggregates.py @@ -43,5 +43,4 @@ with file.open('r') as stream: aggregate.custom_field_values.add(custom_field_value) - print("Created Aggregate", aggregate.prefix) - + print("πŸ—žοΈ Created Aggregate", aggregate.prefix) diff --git a/startup_scripts/150_clusters.py b/startup_scripts/170_clusters.py similarity index 96% rename from startup_scripts/150_clusters.py rename to startup_scripts/170_clusters.py index bc8a268..597f73f 100644 --- a/startup_scripts/150_clusters.py +++ b/startup_scripts/170_clusters.py @@ -54,4 +54,4 @@ with file.open('r') as stream: cluster.custom_field_values.add(custom_field_value) - print("Created cluster", cluster.name) + print("πŸ—„οΈ Created cluster", cluster.name) diff --git a/startup_scripts/155_vrfs.py b/startup_scripts/180_vrfs.py similarity index 96% rename from startup_scripts/155_vrfs.py rename to startup_scripts/180_vrfs.py index 4d7a927..d611c04 100644 --- a/startup_scripts/155_vrfs.py +++ b/startup_scripts/180_vrfs.py @@ -43,5 +43,4 @@ with file.open('r') as stream: vrf.custom_field_values.add(custom_field_value) - print("Created VRF", vrf.name) - + print("πŸ“¦ Created VRF", vrf.name) diff --git a/startup_scripts/160_prefix_vlan_roles.py b/startup_scripts/190_prefix_vlan_roles.py similarity index 86% rename from startup_scripts/160_prefix_vlan_roles.py rename to startup_scripts/190_prefix_vlan_roles.py index 6a460bd..61fa606 100644 --- a/startup_scripts/160_prefix_vlan_roles.py +++ b/startup_scripts/190_prefix_vlan_roles.py @@ -16,4 +16,4 @@ with file.open('r') as stream: role, created = Role.objects.get_or_create(**params) if created: - print("Created Prefix/VLAN Role", role.name) + print("⛹️‍ Created Prefix/VLAN Role", role.name) diff --git a/startup_scripts/170_vlan_groups.py b/startup_scripts/200_vlan_groups.py similarity index 95% rename from startup_scripts/170_vlan_groups.py rename to startup_scripts/200_vlan_groups.py index 06673dd..54250fb 100644 --- a/startup_scripts/170_vlan_groups.py +++ b/startup_scripts/200_vlan_groups.py @@ -43,4 +43,4 @@ with file.open('r') as stream: vlan_group.custom_field_values.add(custom_field_value) - print("Created VLAN Group", vlan_group.name) + print("🏘️ Created VLAN Group", vlan_group.name) diff --git a/startup_scripts/180_vlans.py b/startup_scripts/210_vlans.py similarity index 90% rename from startup_scripts/180_vlans.py rename to startup_scripts/210_vlans.py index 12f2cd1..ab6bd2b 100644 --- a/startup_scripts/180_vlans.py +++ b/startup_scripts/210_vlans.py @@ -1,6 +1,6 @@ from dcim.models import Site from ipam.models import VLAN, VLANGroup, Role -from tenancy.models import Tenant +from tenancy.models import Tenant, TenantGroup from extras.models import CustomField, CustomFieldValue from ruamel.yaml import YAML @@ -18,6 +18,7 @@ with file.open('r') as stream: optional_assocs = { 'site': (Site, 'name'), 'tenant': (Tenant, 'name'), + 'tenant_group': (TenantGroup, 'name'), 'group': (VLANGroup, 'name'), 'role': (Role, 'name') } @@ -47,4 +48,4 @@ with file.open('r') as stream: vlan.custom_field_values.add(custom_field_value) - print("Created VLAN", vlan.name) + print("🏠 Created VLAN", vlan.name) diff --git a/startup_scripts/190_prefixes.py b/startup_scripts/220_prefixes.py similarity index 90% rename from startup_scripts/190_prefixes.py rename to startup_scripts/220_prefixes.py index 208feb8..d13578a 100644 --- a/startup_scripts/190_prefixes.py +++ b/startup_scripts/220_prefixes.py @@ -1,6 +1,6 @@ from dcim.models import Site from ipam.models import Prefix, VLAN, Role, VRF -from tenancy.models import Tenant +from tenancy.models import Tenant, TenantGroup from extras.models import CustomField, CustomFieldValue from ruamel.yaml import YAML @@ -19,6 +19,7 @@ with file.open('r') as stream: optional_assocs = { 'site': (Site, 'name'), 'tenant': (Tenant, 'name'), + 'tenant_group': (TenantGroup, 'name'), 'vlan': (VLAN, 'name'), 'role': (Role, 'name'), 'vrf': (VRF, 'name') @@ -50,4 +51,4 @@ with file.open('r') as stream: prefix.custom_field_values.add(custom_field_value) - print("Created Prefix", prefix.prefix) + print("πŸ“Œ Created Prefix", prefix.prefix) diff --git a/startup_scripts/200_virtual_machines.py b/startup_scripts/230_virtual_machines.py similarity index 95% rename from startup_scripts/200_virtual_machines.py rename to startup_scripts/230_virtual_machines.py index 8845819..449df8a 100644 --- a/startup_scripts/200_virtual_machines.py +++ b/startup_scripts/230_virtual_machines.py @@ -56,4 +56,4 @@ with file.open('r') as stream: virtual_machine.custom_field_values.add(custom_field_value) - print("Created virtual machine", virtual_machine.name) + print("πŸ–₯️ Created virtual machine", virtual_machine.name) diff --git a/startup_scripts/210_virtualization_interfaces.py b/startup_scripts/240_virtualization_interfaces.py similarity index 93% rename from startup_scripts/210_virtualization_interfaces.py rename to startup_scripts/240_virtualization_interfaces.py index f76f876..e1c2b8d 100644 --- a/startup_scripts/210_virtualization_interfaces.py +++ b/startup_scripts/240_virtualization_interfaces.py @@ -43,5 +43,4 @@ with file.open('r') as stream: interface.custom_field_values.add(custom_field_value) - print("Created interface", interface.name, interface.virtual_machine.name) - + print("🧷 Created interface", interface.name, interface.virtual_machine.name) diff --git a/startup_scripts/215_dcim_interfaces.py b/startup_scripts/250_dcim_interfaces.py similarity index 93% rename from startup_scripts/215_dcim_interfaces.py rename to startup_scripts/250_dcim_interfaces.py index 38b9f61..eca5415 100644 --- a/startup_scripts/215_dcim_interfaces.py +++ b/startup_scripts/250_dcim_interfaces.py @@ -42,5 +42,5 @@ with file.open('r') as stream: interface.custom_field_values.add(custom_field_value) - print("Created interface", interface.name, interface.device.name) + print("🧷 Created interface", interface.name, interface.device.name) diff --git a/startup_scripts/220_ip_addresses.py b/startup_scripts/260_ip_addresses.py similarity index 97% rename from startup_scripts/220_ip_addresses.py rename to startup_scripts/260_ip_addresses.py index 2310a2a..13c755d 100644 --- a/startup_scripts/220_ip_addresses.py +++ b/startup_scripts/260_ip_addresses.py @@ -58,4 +58,4 @@ with file.open('r') as stream: ip_address.custom_field_values.add(custom_field_value) - print("Created IP Address", ip_address.address) + print("🧬 Created IP Address", ip_address.address)