ADAPTER = 'openstack'
METADATA = {
    'security': {
        '_self': {
            'required_in_whole_config': True,
        },
        'service_credentials': {
            '_self': {
                'required_in_whole_config': True,
                'key_extensions': {
                '$service': ['image', 'compute', 'dashboard', 'identity', 'metering', 'network', 'rabbitmq', 'volume', 'mysql', 'heat', 'alarming', 'policy']
                },
                'mapping_to': 'service_credentials'
            },
            '$service': {
               '_self': {
                   'required_in_whole_config': True,
                   'mapping_to': '$service'
               },
               'username': {
                   '_self': {
                       'is_required': True,
                       'field': 'username',
                       'mapping_to': 'username'
                   }
               },
               'password': {
                   '_self': {
                       'is_required': True,
                       'field': 'password',
                       'mapping_to': 'password'
                   }
               }
            }
        },
        'console_credentials': {
            '_self': {
                'required_in_whole_config': True,
                'key_extensions': {
                    '$console': ['admin', 'demo', 'compute', 'dashboard', 'image', 'identity', 'metering', 'network', 'object-store', 'volume', 'heat', 'alarming', 'policy']
                },
                'mapping_to': 'console_credentials'
            },
            '$console': {
                '_self': {
                    'required_in_whole_config': True,
                    'mapping_to': '$console'
                },
                'username': {
                    '_self': {
                        'is_required': True,
                        'field': 'username',
                        'mapping_to': 'username'
                    }
                },
                'password': {
                    '_self': {
                        'is_required': True,
                        'field': 'password',
                        'mapping_to': 'password'
                    }
                }
            }
        }
    },

    'enable_secgroup': {
        '_self': {
            'mapping_to': 'enable_secgroup',
            'field': 'anytype',
            'is_required':False,
            'default_value': True
        }
    },

    'enable_fwaas': {
        '_self': {
            'mapping_to': 'enable_fwaas',
            'field': 'anytype',
            'is_required':False,
            'default_value': True
        }
    },
    'enable_vpnaas': {
        '_self': {
            'mapping_to': 'enable_vpnaas',
            'field': 'anytype',
            'is_required':False,
            'default_value': True
        }
    },
    'odl_l3_agent': {
        '_self': {
            'mapping_to': 'odl_l3_agent',
            'field': 'anytype',
            'is_required':False,
            'default_value': 'Disable'
        }
    },
    'onos_sfc': {
        '_self': {
            'mapping_to': 'onos_sfc',
            'field': 'anytype',
            'is_required':False,
            'default_value': 'Disable'
        }
    },
    'odl_sfc': {
        '_self': {
            'mapping_to': 'odl_sfc',
            'field': 'anytype',
            'is_required':False,
            'default_value': 'Disable'
        }
    },
    'moon': {
        '_self': {
            'mapping_to': 'moon',
            'field': 'anytype',
            'is_required':False,
            'default_value': 'Disable'
        }
    },
    'ha_network': {
        '_self': {
            'mapping_to': 'ha_network',
            'field': 'anytype',
            'is_required':False,
            'default_value': 'Disable'
        }
    },
    'network_cfg': {
        '_self': {
            'mapping_to': 'network_cfg'
        },

        'nic_mappings': {
            '_self': {
                'mapping_to': 'nic_mappings',
                'field': 'general_list'
            }
        },

        'bond_mappings': {
            '_self': {
                'mapping_to': 'bond_mappings',
                'field': 'general_list'
            }
        },

        'sys_intf_mappings': {
            '_self': {
                'mapping_to': 'sys_intf_mappings',
                'field': 'general_list'
            }
        },

        'ip_settings': {
             '_self': {
                 'mapping_to': 'ip_settings',
                 'field': 'general_list'
             }
        },

        'provider_net_mappings': {
            '_self': {
                'mapping_to': 'provider_net_mappings',
                'field': 'general_list'
            }
        },

        'ceph_disk': {
            '_self': {
                'mapping_to': 'ceph_disk',
                'field': 'general',
                'is_required':False
            }
        },

        'public_vip': {
        '_self': {
            'mapping_to': 'public_vip',
            'is_required': False
        },

        'ip': {
            '_self': {
            'mapping_to': 'ip',
            'is_required': True,
            'field': 'general',
            }
        },
        'netmask': {
            '_self': {
            'mapping_to': 'netmask',
            'is_required': True,
            'field': 'general',
            }
        },
        'interface': {
            '_self': {
            'mapping_to': 'interface',
            'is_required': True,
            'field': 'general',
            }
        }
        },

        'internal_vip': {
        '_self': {
            'mapping_to': 'internal_vip',
            'is_required': False
        },

        'ip': {
            '_self': {
            'mapping_to': 'ip',
            'is_required': True,
            'field': 'general',
            }
        },
        'netmask': {
            '_self': {
            'mapping_to': 'netmask',
            'is_required': True,
            'field': 'general',
            }
        },
        'interface': {
            '_self': {
            'mapping_to': 'interface',
            'is_required': True,
            'field': 'general',
            }
        }
    },

    'onos_nic': {
        '_self': {
            'mapping_to': 'onos_nic',
            'is_required': False,
            'field': 'general',
            'default_value': 'eth2'
        }
    },

    'openo_net': {
        '_self': {
            'mapping_to': 'openo_net',
            'is_required': False
        },

        'openo_ip': {
            '_self': {
            'mapping_to': 'openo_ip',
            'is_required': False,
            'field': 'general',
            }
        },
        'openo_docker_gw': {
            '_self': {
            'mapping_to': 'openo_docker_gw',
            'is_required': False,
            'field': 'general',
            }
        },
        'openo_docker_cidr': {
            '_self': {
            'mapping_to': 'openo_docker_cidr',
            'is_required': False,
            'field': 'general',
            }
        }
    },


    'public_net_info': {
        '_self': {
            'mapping_to': 'public_net_info'
        },

        'enable': {
            '_self': {
            'mapping_to': 'enable',
            'is_required': False,
            'field': 'anytype',
            'default_value': True
            }
        },

        'network': {
            '_self': {
            'mapping_to': 'network',
            'is_required': True,
            'field': 'general',
            'default_value': 'ext-net'
            }
        },

        'type': {
            '_self': {
            'mapping_to': 'type',
            'is_required': True,
            'field': 'general',
            'options': ['flat', 'vlan'],
            'default_value': 'vlan'
            }
        },

        'segment_id': {
            '_self': {
            'mapping_to': 'segment_id',
            'is_required': False,
            'field': 'anytype'
            }
        },

        'subnet': {
            '_self': {
            'mapping_to': 'subnet',
            'is_required': True,
            'field': 'general',
            'default_value': 'ext-subnet'
            }
        },

        'provider_network': {
            '_self': {
            'mapping_to': 'provider_network',
            'is_required': True,
            'field': 'general',
            'default_value': 'physnet'
            }
        },

        'router': {
            '_self': {
            'mapping_to': 'router',
            'is_required': True,
            'field': 'general',
            'default_value': 'ext-router'
            }
        },

        'enable_dhcp': {
            '_self': {
            'mapping_to': 'enable_dhcp',
            'is_required': True,
            'field': 'anytype'
            }
        },

        'no_gateway': {
            '_self': {
            'mapping_to': 'no_gateway',
            'is_required': True,
            'field': 'anytype'
            }
        },

        'external_gw': {
            '_self': {
            'mapping_to': 'external_gw',
            'is_required': False,
            'field': 'general'
            }
        },

        'floating_ip_cidr': {
            '_self': {
            'mapping_to': 'floating_ip_cidr',
            'is_required': True,
            'field': 'general'
            }
        },

        'floating_ip_start': {
            '_self': {
            'mapping_to': 'floating_ip_start',
            'is_required': True,
            'field': 'general'
            }
        },

        'floating_ip_end': {
            '_self': {
            'mapping_to': 'floating_ip_end',
            'is_required': True,
            'field': 'general'
            }
        }
    },
    },
    'neutron_config': {
        '_self': {
            'mapping_to': 'neutron_config'
        },
        'openvswitch': {
            '_self': {
                'mapping_to': 'openvswitch',
                'required_in_whole_config': True
            },
            'tenant_network_type': {
                '_self': {
                    'mapping_to': 'tenant_network_type',
                    'is_required': True,
                    'field': 'general',
                    'options': ['gre', 'vlan'],
                    'default_value': 'gre'
                }
            },
            'network_vlan_ranges': {
                '_self': {
                    'mapping_to': 'vlan_ranges',
                    'is_required': False,
                    'field': 'general_list',
                    'default_value': ['physnet1:2700:2999']
                }
            },
            'bridge_mappings': {
                '_self': {
                    'mapping_to': 'bridge_mappings',
                    'is_required': False,
                    'field': 'general_list',
                    'default_value': ['physnet1:br-eth1']
                }
            },
            'tunnel_id_ranges': {
                '_self': {
                    'mapping_to': 'tunnel_id_ranges',
                    'is_required': False,
                    'field': 'general_list',
                    'default_value': ['1:1000']
                }
            }
        }
    },
    'network_mapping': {
        '_self': {
            'required_in_whole_config': True,
                'key_extensions': {
                '$interface_type': ['install']
            }
        },
        '$interface_type': {
            '_self': {
                'required_in_whole_config': True,
                'field': 'anytype',
                'autofill_callback': autofill_network_mapping,
                'mapping_to': '$interface_type'
            },
            'interface': {
                '_self': {
                    'is_required': True,
                    'field': 'general',
                }
            },
            'subnet': {
                '_self': {
                    'is_required': False,
                    'field': 'general'
                }
            }
        }
    },

}