mirror of
https://github.com/netbox-community/netbox.git
synced 2024-05-10 07:54:54 +00:00
39 lines
1.5 KiB
Python
39 lines
1.5 KiB
Python
# -*- coding: utf-8 -*-
|
|
# Generated by Django 1.11.3 on 2017-07-14 17:26
|
|
from django.db import migrations, models
|
|
|
|
|
|
def rpc_client_to_napalm_driver(apps, schema_editor):
|
|
"""
|
|
Migrate legacy RPC clients to their respective NAPALM drivers
|
|
"""
|
|
Platform = apps.get_model('dcim', 'Platform')
|
|
|
|
Platform.objects.filter(rpc_client='juniper-junos').update(napalm_driver='junos')
|
|
Platform.objects.filter(rpc_client='cisco-ios').update(napalm_driver='ios')
|
|
|
|
|
|
class Migration(migrations.Migration):
|
|
|
|
dependencies = [
|
|
('dcim', '0040_inventoryitem_add_asset_tag_description'),
|
|
]
|
|
|
|
operations = [
|
|
migrations.AlterModelOptions(
|
|
name='device',
|
|
options={'ordering': ['name'], 'permissions': (('napalm_read', 'Read-only access to devices via NAPALM'), ('napalm_write', 'Read/write access to devices via NAPALM'))},
|
|
),
|
|
migrations.AddField(
|
|
model_name='platform',
|
|
name='napalm_driver',
|
|
field=models.CharField(blank=True, help_text='The name of the NAPALM driver to use when interacting with devices.', max_length=50, verbose_name='NAPALM driver'),
|
|
),
|
|
migrations.AlterField(
|
|
model_name='platform',
|
|
name='rpc_client',
|
|
field=models.CharField(blank=True, choices=[['juniper-junos', 'Juniper Junos (NETCONF)'], ['cisco-ios', 'Cisco IOS (SSH)'], ['opengear', 'Opengear (SSH)']], max_length=30, verbose_name='Legacy RPC client'),
|
|
),
|
|
migrations.RunPython(rpc_client_to_napalm_driver),
|
|
]
|