diff --git a/configuration-python/generic_code/apicPython/createL4L7Cluster.py b/configuration-python/generic_code/apicPython/createL4L7Cluster.py new file mode 100644 index 0000000..6379b79 --- /dev/null +++ b/configuration-python/generic_code/apicPython/createL4L7Cluster.py @@ -0,0 +1,154 @@ + +from cobra.model.vns import LDevVip, RsMDevAtt, CCred, CCredSecret, CMgmt, RsALDevToDomP, RsALDevToPhysDomP, DevFolder, DevParam +from createMo import * +import getpass +import sys + +DEFAULT_CONTEXT_AWARENESS = 'single-Context' +DEFAULT_DEVICE_TYPE = 'PHYSICAL' +DEFAULT_FUNCTION_TYPE = 'GoTo' + +def input_key_args(): + return input_raw_input('Device Cluster Name', required=True) + +def input_optional_args(): + args = { + 'contextAware': input_options('L4-L7 Device Cluster - Context Awareness', default=DEFAULT_CONTEXT_AWARENESS, options=['single-Context', 'multi-Context']), + 'devtype': input_options('L4-L7 Device Cluster - Device Type', default=DEFAULT_DEVICE_TYPE, options=['PHYSICAL', 'VIRTUAL']), + 'funcType': input_options('L4-L7 Device Cluster - Function Type', default=DEFAULT_FUNCTION_TYPE, options=['GoTo','GoThrough']), + } + return args + +def create_l4l7_cluster(fv_tenant, name, **args): + """Create L4L7 Cluster""" + args = args['optional_args'] if 'optional_args' in args.keys() else args + valid_keys = ['contextAware', 'devtype', 'funcType'] + kwargs = {k: v for k, v in args.items() if (k in valid_keys and v)} + + vns_ldevvip = LDevVip(fv_tenant, name, **kwargs) + if 'device_package' in args: + vns_rsmdevatt = add_metadata_source_relation(vns_ldevvip, optional_args=args) + if 'cluster_username' in args: + vns_ccred = add_concrete_device_access_credentials(vns_ldevvip, optional_args=args) + if 'cluster_password' in args: + vns_ccredsecret = add_concrete_device_access_credentials_secret(vns_ldevvip, optional_args=args) + if 'cluster_ip' in args or 'cluster_port' in args: + vns_cmgmt = add_management_interface(vns_ldevvip, optional_args=args) + if 'vmm_provider' in args and 'vmm_domain' in args: + vns_rsaldevtodomp = add_source_relation_to_vmm_domain_profile(vns_ldevvip, optional_args=args) + if 'physical_domain' in args: + vns_rsaldevtophysdomp = add_source_relation_to_physical_domain_profile(vns_ldevvip, optional_args=args) + if 'device_folders' in args: + add_l4l7_device_folders(vns_ldevvip, args['device_folders']) + return vns_ldevvip + +def add_metadata_source_relation(cluster_mo, **args): + """vnsRsMDevAtt: "A source relation to the metadata definitions for a service device type. Functions as a pointer to the device package. + e.g: uni/infra/mDev-{device_package_vendor}-{device_package_model}-{device_package_version} + """ + args = args['optional_args'] if 'optional_args' in args.keys() else args + tdn = 'uni/infra/mDev-{device_package}'.format(**args) + return RsMDevAtt(cluster_mo, tDn=tdn) + +def add_concrete_device_access_credentials(cluster_mo, **args): + """The concrete device access credentials in the L4-L7 device cluster. The concrete device access credentials normally include a password that is not displayed and is stored in encrypted form.""" + args = args['optional_args'] if 'optional_args' in args.keys() else args + return CCred(cluster_mo, name='username', value=args['cluster_username']) + +def add_concrete_device_access_credentials_secret(cluster_mo, **args): + """The secret for the concrete device access credentials in the L4-L7 device cluster. The concrete device access credentials normally include a password that is not displayed and is stored in encrypted form.""" + args = args['optional_args'] if 'optional_args' in args.keys() else args + return CCredSecret(cluster_mo, name='password', value=args['cluster_password']) + +def add_management_interface(cluster_mo, **args): + """The management interface is used to manage a concrete device in the L4-L7 device cluster. The management interface is identified by a host address and port number.""" + args = args['optional_args'] if 'optional_args' in args.keys() else args + valid_keys = ['cluster_ip', 'cluster_port'] + key_map = {'cluster_ip': 'host', 'cluster_port': 'port'} + kwargs = {k: v for k, v in args.items() if (k in valid_keys and v)} + kwargs = {key_map[k]: v for k, v in kwargs.items()} + return CMgmt(cluster_mo, name='devMgmt', **kwargs) + +def add_source_relation_to_vmm_domain_profile(cluster_mo, **args): + """A source relation to the VMM domain profile.""" + args = args['optional_args'] if 'optional_args' in args.keys() else args + valid_keys = ['vmm_provider', 'vmm_domain'] + kwargs = {k: v for k, v in args.items() if (k in valid_keys and v)} + return RsALDevToDomP(cluster_mo, tDn='uni/vmmp-{vmm_provider}/dom-{vmm_domain}'.format(**kwargs)) + +def add_source_relation_to_physical_domain_profile(cluster_mo, **args): + """A source relation to a physical domain profile.""" + args = args['optional_args'] if 'optional_args' in args.keys() else args + valid_keys = ['physical_domain'] + kwargs = {k: v for k, v in args.items() if (k in valid_keys and v)} + return RsALDevToPhysDomP(cluster_mo, tDn='uni/phys-{physical_domain}'.format(**kwargs)) + +def add_l4l7_device_folders(parent_mo, folder_list): + for folder in folder_list: + add_l4l7_device_folder(parent_mo, **folder) + +def add_l4l7_device_folder(parent_mo, **args): + """Recursively add device folders and parameters to parent mo. + + @param parent_mo: The parent MO of the top level folder is the CDev, but the parent MO of a subfolder is its parent folder. + """ + args = args['optional_args'] if 'optional_args' in args.keys() else args + folder_required_keys = ['name', 'key'] + param_required_keys = ['name', 'key', 'value'] + + # parse folders + if all(k in args.keys() for k in folder_required_keys): + vns_devfolder = DevFolder(parent_mo, **{k: v for k,v in args.items() if k in folder_required_keys and v}) + + # parse params + if 'device_params' in args.keys(): # This folder contains device params + for param in args['device_params']: + if all(k in param.keys() for k in param_required_keys): + DevParam(vns_devfolder, **param) + + # parse subfolders + if 'device_folders' in args.keys(): + for folder in args['device_folders']: + add_l4l7_device_folder(vns_devfolder, **folder) + else: + raise Exception('Invalid L4-L7 device folder configuration. Missing required keys "{0}": {1}'.format(folder_required_keys, repr(args))) + +class CreateL4L7Cluster(CreateMo): + def __init__(self): + self.description = 'Create an L4-L7 device cluster' + self.tenant_required = True + self.contract = None + super(CreateL4L7Cluster, self).__init__() + + def set_cli_mode(self): + super(CreateL4L7Cluster, self).set_cli_mode() + self.parser_cli.add_argument('name', help='Cluster Name') + self.parser_cli.add_argument('-d', '--device_package', help='Device package, e.g "Cisco-FirePOWER-1.0"', metavar='VENDOR-MODEL-VERSION') + self.parser_cli.add_argument('-f', '--function_type', choices=['GoTo','GoThrough'], dest='funcType', help='A GoTo device has a specific destination, depending on the package. A GoThrough device is a transparent device.') + self.parser_cli.add_argument('-t', '--device_type', choices=['PHYSICAL', 'VIRTUAL'], dest='devtype', help='Specifies whether the device cluster has PHYSICAL appliances or VIRTUAL appliances.') + self.parser_cli.add_argument('-u1', '--username', dest='cluster_username', help='Username for the L4-L7 cluster.') + self.parser_cli.add_argument('-u2', '--password', dest='cluster_password', help='Password for the L4-L7 cluster.') + self.parser_cli.add_argument('-i', '--ip', dest='cluster_ip', help='IP Address of the L4-L7 cluster host.') + self.parser_cli.add_argument('-p', '--port', dest='cluster_port', help='Port of the L4-L7 cluster host.') + self.parser_cli.add_argument('-x', '--context_aware', choices=['single-Context', 'multi-Context'], dest='contextAware', + help='The context-awareness of the Device Cluster. Single means that the device cluster cannot be shared across multiple tenants of a given type that are hosted on the provider network. Multiple means that the device cluster can be shared across multiple tenants of a given type that you are hosting on this provider network. ') + + def read_key_args(self): + self.tenant = self.args.pop('tenant') + self.name = self.args.pop('name') + + def wizard_mode_input_args(self): + self.args['name'] = input_key_args() + if not self.delete: + self.args['optional_args'] = input_optional_args() + + def delete_mo(self): + self.check_if_mo_exist('uni/tn-'+self.tenant+'/lDevVip-', self.name, LDevVip, description='LDevVip') + super(CreateL4L7Cluster, self).delete_mo() + + def main_function(self): + fv_tenant = self.check_if_tenant_exist() + vns_ldevvip = create_l4l7_cluster(fv_tenant, self.name, optional_args=self.optional_args) + +if __name__ == '__main__': + mo = CreateL4L7Cluster() \ No newline at end of file diff --git a/configuration-python/generic_code/apicPython/createL4L7Cluster.yaml b/configuration-python/generic_code/apicPython/createL4L7Cluster.yaml new file mode 100644 index 0000000..a46e2de --- /dev/null +++ b/configuration-python/generic_code/apicPython/createL4L7Cluster.yaml @@ -0,0 +1,17 @@ + +host: 10.10.10.10 +user: admin +password: password + +tenant: my_tenant +name: my_cluster +context_aware: single-Context +device_type: PHYSICAL +function_type: GoThrough +cluster_username: admin +cluster_password: cluster_password +cluster_ip: 10.10.10.11 +cluster_port: 443 +device_package_vendor: Cisco +device_package_model: FirePOWER +device_package_version: 1.0 diff --git a/configuration-python/generic_code/apicPython/createL4L7ConcreteInterface.py b/configuration-python/generic_code/apicPython/createL4L7ConcreteInterface.py new file mode 100644 index 0000000..5274750 --- /dev/null +++ b/configuration-python/generic_code/apicPython/createL4L7ConcreteInterface.py @@ -0,0 +1,32 @@ + +from cobra.model.vns import CDev, CIf, RsCIfPathAtt +from createMo import * + +def input_key_args(): + return input_raw_input('Concrete Interface Name', required=True) + +def input_optional_args(): + args = {} + # TODO + return args + +def create_l4l7_concrete_interface(parent_mo, name, **args): + """Create L4L7 Concrete Interface""" + args = args['optional_args'] if 'optional_args' in args.keys() else args + valid_keys = ['name', 'vnicName'] + kwargs = {k: v for k, v in args.items() if (k in valid_keys and v)} + vns_cif = CIf(parent_mo, name, **kwargs) + if 'path' in args: + vns_rscifpathatt = add_source_relation_to_path_endpoint(vns_cif, args['path']) + return vns_cif + +def add_source_relation_to_path_endpoint(concrete_interface_mo, path): + """A source relation to a path endpoint. e.g: 'topology/pod-1/paths-1001/pathep-[eth1/10]' """ + return RsCIfPathAtt(concrete_interface_mo, tDn=path) + +class CreateL4L7ConcreteInterface(CreateMo): + def __init__(self): + self.description = 'Create an L4-L7 concrete device' + self.tenant_required = True + self.contract = None + super(CreateL4L7ConcreteInterface, self).__init__() \ No newline at end of file diff --git a/configuration-python/generic_code/apicPython/createL4L7Device.py b/configuration-python/generic_code/apicPython/createL4L7Device.py new file mode 100644 index 0000000..5834d93 --- /dev/null +++ b/configuration-python/generic_code/apicPython/createL4L7Device.py @@ -0,0 +1,119 @@ + +from cobra.model.vns import CDev, LDevVip, CCred, CCredSecret, CMgmt, RsCDevToCtrlrP, DevFolder, DevParam +from createMo import * + +def input_key_args(): + return input_raw_input('Concrete Device Name', required=True) + +def input_optional_args(): + args = {} + # TODO + return args + +def create_l4l7_device(parent_mo, name, **args): + """Create L4L7 Device""" + args = args['optional_args'] if 'optional_args' in args.keys() else args + valid_keys = ['name', 'vmName', 'vcenterName', 'devCtxLbl'] + kwargs = {k: v for k, v in args.items() if (k in valid_keys and v)} + vns_cdev = CDev(parent_mo, name, **kwargs) + if 'device_username' in args: + vns_ccred = add_concrete_device_access_credentials(vns_cdev, optional_args=args) + if 'device_password' in args: + vns_ccredsecret = add_concrete_device_access_credentials_secret(vns_cdev, optional_args=args) + if 'device_ip' in args or 'device_port' in args: + vns_cmgmt = add_management_interface(vns_cdev, optional_args=args) + if 'vmm_provider' in args and 'vmm_domain' in args and 'vmm_controller' in args: + vns_rscdevtoctrlrp = add_source_relation_to_vmm_domain_controller_profile(vns_cdev, optional_args=args) + if 'device_folders' in args: + add_l4l7_device_folders(vns_cdev, args['device_folders']) + return vns_cdev + +def add_concrete_device_access_credentials(device_mo, **args): + """The concrete device access credentials in the L4-L7 device cluster. The concrete device access credentials normally include a password that is not displayed and is stored in encrypted form.""" + args = args['optional_args'] if 'optional_args' in args.keys() else args + return CCred(device_mo, name='username', value=args['device_username']) + +def add_concrete_device_access_credentials_secret(device_mo, **args): + """The secret for the concrete device access credentials in the L4-L7 device cluster. The concrete device access credentials normally include a password that is not displayed and is stored in encrypted form.""" + args = args['optional_args'] if 'optional_args' in args.keys() else args + return CCredSecret(device_mo, name='password', value=args['device_password']) + +def add_management_interface(device_mo, **args): + """The management interface is used to manage a concrete device in the L4-L7 device cluster. The management interface is identified by a host address and port number.""" + args = args['optional_args'] if 'optional_args' in args.keys() else args + valid_keys = ['device_ip', 'device_port'] + key_map = {'device_ip': 'host', 'device_port': 'port'} + kwargs = {k: v for k, v in args.items() if (k in valid_keys and v)} + kwargs = {key_map[k]: v for k, v in kwargs.items()} + return CMgmt(device_mo, name='devMgmt', **kwargs) + +def add_source_relation_to_vmm_domain_controller_profile(device_mo, **args): + """Source relation to the vmm domain controller profile for validation.""" + args = args['optional_args'] if 'optional_args' in args.keys() else args + valid_keys = ['vmm_provider','vmm_domain','vmm_controller'] + kwargs = {k: v for k, v in args.items() if (k in valid_keys and v)} + return RsCDevToCtrlrP(device_mo, tDn='uni/vmmp-{vmm_provider}/dom-{vmm_domain}/ctrlr-{vmm_controller}'.format(**kwargs)) + +def add_l4l7_device_folders(parent_mo, folder_list): + for folder in folder_list: + add_l4l7_device_folder(parent_mo, **folder) + +def add_l4l7_device_folder(parent_mo, **args): + """Recursively add device folders and parameters to parent mo. + + @param parent_mo: The parent MO of the top level folder is the CDev, but the parent MO of a subfolder is its parent folder. + """ + args = args['optional_args'] if 'optional_args' in args.keys() else args + folder_required_keys = ['name', 'key'] + param_required_keys = ['name', 'key', 'value'] + + # parse folders + if all(k in args.keys() for k in folder_required_keys): + vns_devfolder = DevFolder(parent_mo, **{k: v for k,v in args.items() if k in folder_required_keys and v}) + + # parse params + if 'device_params' in args.keys(): # This folder contains device params + for param in args['device_params']: + if all(k in param.keys() for k in param_required_keys): + DevParam(vns_devfolder, **param) + + # parse subfolders + if 'device_folders' in args.keys(): + for folder in args['device_folders']: + add_l4l7_device_folder(vns_devfolder, **folder) + else: + raise Exception('Invalid L4-L7 device folder configuration. Missing required keys "{0}": {1}'.format(folder_required_keys, repr(args))) + +class CreateL4L7Device(CreateMo): + def __init__(self): + self.description = 'Create an L4-L7 concrete device' + self.tenant_required = True + self.contract = None + super(CreateL4L7Device, self).__init__() + + def set_cli_mode(self): + super(CreateL4L7Device, self).set_cli_mode() + self.parser_cli.add_argument('cluster_name', help='Name of the parent L4-L7 Device Cluster') + self.parser_cli.add_argument('name', help='Device Name') + + def read_key_args(self): + self.tenant = self.args.pop('tenant') + self.cluster_name = self.args.pop('cluster_name') + self.name = self.args.pop('name') + + def wizard_mode_input_args(self): + self.args['name'] = input_key_args() + if not self.delete: + self.args['optional_args'] = input_optional_args() + + def delete_mo(self): + self.check_if_mo_exist('uni/tn-{tenant}/lDevVip-{cluster_name}/cDev-'.format(**self.__dict__), self.name, CDev, description='CDev') + super(CreateL4L7Device, self).delete_mo() + + def main_function(self): + # Query a tenant + parent_mo = self.check_if_mo_exist('uni/tn-{tenant}/lDevVip-'.format(**self.__dict__), self.cluster_name, LDevVip, description='LDevVip') + vns_cdev = create_l4l7_device(parent_mo, self.name, optional_args=self.optional_args) + +if __name__ == '__main__': + mo = CreateL4L7Device() \ No newline at end of file diff --git a/configuration-python/generic_code/apicPython/createL4L7LogicalInterface.py b/configuration-python/generic_code/apicPython/createL4L7LogicalInterface.py new file mode 100644 index 0000000..99fa2ac --- /dev/null +++ b/configuration-python/generic_code/apicPython/createL4L7LogicalInterface.py @@ -0,0 +1,42 @@ + +from cobra.model.vns import CDev, LIf, RsMetaIf, RsCIfAtt, RsCIfAttN +from createMo import * + +def input_key_args(): + return input_raw_input('Concrete Interface Name', required=True) + +def input_optional_args(): + args = {} + # TODO + return args + +def create_l4l7_logical_interface(parent_mo, name, **args): + """The logical interface is associated with a set of concrete interfaces from the L4-L7 device cluster. This is used to define the connection between a service graph and device interfaces.""" + args = args['optional_args'] if 'optional_args' in args.keys() else args + valid_keys = ['encap'] + kwargs = {k: v for k, v in args.items() if (k in valid_keys and v)} + vns_lif = LIf(parent_mo, name, **kwargs) + if 'label' in args: + vns_rsmetaif = add_source_relation_to_interface_label(vns_lif, device_package=args['device_package'], label=args['label']) + if 'concrete_interface': + vns_rscifatt = add_association_to_concrete_interface(vns_lif, tenant=args['tenant'], cluster=args['cluster'], device=args['device'], cifname=args['cifname']) + return vns_lif + +def add_source_relation_to_interface_label(logical_interface_mo, **args): + """A source relation to an interface label. e.g: tDn='uni/infra/mDev-Cisco-FirePOWER-1.0/mIfLbl-external' """ + valid_keys = ['device_package', 'label'] + kwargs = {k: v for k, v in args.items() if (k in valid_keys and v)} + return RsMetaIf(logical_interface_mo, tDn='uni/infra/mDev-{device_package}/mIfLbl-{label}'.format(**kwargs)) + +def add_association_to_concrete_interface(logical_interface_mo, **args): + """Association to a set of concrete interfaces from the device in the cluster.""" + valid_keys = ['tenant', 'cluster', 'device', 'cifname'] + kwargs = {k: v for k, v in args.items() if (k in valid_keys and v)} + return RsCIfAtt(logical_interface_mo, tDn='uni/tn-{tenant}/lDevVip-{cluster}/cDev-{device}/cIf-[{cifname}]'.format(**kwargs)) + +class CreateL4L7ConcreteInterface(CreateMo): + def __init__(self): + self.description = 'Create an L4-L7 concrete device' + self.tenant_required = True + self.contract = None + super(CreateL4L7ConcreteInterface, self).__init__() \ No newline at end of file diff --git a/configuration-python/generic_code/apicPython/dynamicallyCreateApplication.py b/configuration-python/generic_code/apicPython/dynamicallyCreateApplication.py index 27a9677..efc79cb 100644 --- a/configuration-python/generic_code/apicPython/dynamicallyCreateApplication.py +++ b/configuration-python/generic_code/apicPython/dynamicallyCreateApplication.py @@ -10,6 +10,10 @@ from apicPython import createApplication from apicPython import createApplicationEpg from apicPython import connectEpgContract +from apicPython import createL4L7Cluster +from apicPython import createL4L7Device +from apicPython import createL4L7ConcreteInterface +from apicPython import createL4L7LogicalInterface class DynamicallyCreateApplication(LabScript): @@ -25,19 +29,21 @@ def __init__(self): self.application_optional_args = None self.epgs = [] self.applied_contracts = [] + self.l4l7_devices = [] super(DynamicallyCreateApplication, self).__init__() def run_yaml_mode(self): super(DynamicallyCreateApplication, self).run_yaml_mode() - self.security_domains = self.args['security_domains'] - self.private_network = self.args['private_network'] - self.bridge_domains = self.args['bridge_domains'] - self.filters = self.args['filters'] - self.contracts = self.args['contracts'] - self.application = self.args['application']['name'] - self.application_optional_args = self.args['application']['optional_args'] - self.epgs = self.args['epgs'] - self.applied_contracts = self.args['applied_contracts'] + self.security_domains = self.args.get('security_domains', []) + self.private_network = self.args.get('private_network', []) + self.bridge_domains = self.args.get('bridge_domains', []) + self.filters = self.args.get('filters', []) + self.contracts = self.args.get('contracts', []) + self.application = self.args.get('application', {}).get('name', '') + self.application_optional_args = self.args.get('application', {}).get('optional_args', []) + self.epgs = self.args.get('epgs', []) + self.applied_contracts = self.args.get('applied_contracts', []) + self.l4l7_devices = self.args.get('l4l7_devices', []) def run_wizard_mode(self): print 'Wizard mode is not supported in this method. Please try Yaml mode.' @@ -56,7 +62,8 @@ def main_function(self): addSecurityDomain.add_security_domain(fv_tenant, security_domain) # create private network - createPrivateNetwork.create_private_network(fv_tenant, self.private_network) + if self.private_network: + createPrivateNetwork.create_private_network(fv_tenant, self.private_network) # create bridge domains for bridge_domain in self.bridge_domains: @@ -81,7 +88,8 @@ def main_function(self): createContract.add_filter_to_subject(vz_subj, filter) # create application - fv_ap = createApplication.create_application(fv_tenant, self.application, optional_args=self.application_optional_args) + if self.application: + fv_ap = createApplication.create_application(fv_tenant, self.application, optional_args=self.application_optional_args) # create EPGs for epg in self.epgs: @@ -94,5 +102,33 @@ def main_function(self): connectEpgContract.connect_epg_contract(fv_aepg, contract['contract'], contract['type']) self.commit_change(changed_object=fv_aepg) + # add L4L7 clusters/devices + for cluster in self.l4l7_devices: + + # add cluster + vns_ldevvip = createL4L7Cluster.create_l4l7_cluster(fv_tenant, **cluster) + self.commit_change(changed_object=vns_ldevvip) + + # add devices to cluster + if is_valid_key(cluster, 'devices'): + for device in cluster['devices']: + if 'vmm provider' in cluster and 'vmm_domain' in cluster: + vns_cdev = createL4L7Device.create_l4l7_device(vns_ldevvip, vmm_provider=cluster['vmm_provider'], vmm_domain=cluster['vmm_domain'], **device) + else: + vns_cdev = createL4L7Device.create_l4l7_device(vns_ldevvip, **device) + self.commit_change(changed_object=vns_cdev) + + # add concrete interfaces to devices + if is_valid_key(device, 'concrete_interfaces'): + for interface in device['concrete_interfaces']: + vns_cif = createL4L7ConcreteInterface.create_l4l7_concrete_interface(vns_cdev, **interface) + self.commit_change(changed_object=vns_cif) + + # add logical interfaces to cluster + if is_valid_key(cluster, 'logical_interfaces'): + for logical_interface in cluster['logical_interfaces']: + vns_lif = createL4L7LogicalInterface.create_l4l7_logical_interface(vns_ldevvip, logical_interface['name'], device=logical_interface['device'], label=logical_interface['label'], tenant=self.tenant, cluster=cluster['name'], cifname=logical_interface['concrete_interface'], device_package=cluster['device_package']) + self.commit_change(changed_object=vns_lif) + if __name__ == '__main__': mo = DynamicallyCreateApplication() diff --git a/configuration-python/generic_code/apicPython/dynamicallyCreateApplication.yaml b/configuration-python/generic_code/apicPython/dynamicallyCreateApplication.yaml index 16a86a5..e34ec45 100644 --- a/configuration-python/generic_code/apicPython/dynamicallyCreateApplication.yaml +++ b/configuration-python/generic_code/apicPython/dynamicallyCreateApplication.yaml @@ -207,7 +207,7 @@ epgs: encap: vlan-13 deployment_immediacy: lazy mode: untagged - + # Specify the relationship (provided or consumed) between contract and epg. # Usage: # - contract: @@ -229,3 +229,137 @@ applied_contracts: - contract: DB_Con epg: App_EPG type: consumed + +# Specify L4-L7 device clusters in this tenant. +# All top-level sections are optional. All parameters other than "name" are optional, with the exception of keys in the "logical_interfaces" section. +# +# Usage: +# - name: +# context_aware: [single-Context | multi-Context] +# device_type: [PHYSICAL | VIRTUAL] +# function_type: [GoTo | GoThrough] +# cluster_username: +# cluster_password: +# cluster_ip: +# cluster_port: +# device_package: -- +# device_folders: # Recursive; device folders can contain other device folders. +# - name: +# key: +# device_params: +# - name: +# key: +# value: +# physical_domain: phys # For physical devices. +# vmm_provider: VMware # For virtual devices. +# vmm_domain: my_firepower_domain # For virtual devices. +# +# devices: +# - name: +# vmName: # For virtual devices. +# vcenterName: # For virtual devices. +# vmm_controller: +# device_ip: +# device_port: +# device_folders: # Recursive; device folders can contain other device folders. +# - name: +# key: +# device_params: +# - name: +# key: +# value: +# +# concrete_interfaces: +# - name: +# vnicName: # For virtual devices. +# path: # For physical devices. Path to the physical port/PC/vPC. +# +# logical_interfaces: +# - name: +# label: # Mandatory. Varies between device packages. See the device package device specification file for valid labels. +# device: # Mandatory. +# concrete_interface: # Mandatory. +l4l7_devices: +- name: my_cluster + context_aware: single-Context + device_type: PHYSICAL + function_type: GoThrough + cluster_username: admin + cluster_password: cluster_password + cluster_ip: 10.10.10.11 + cluster_port: 443 + device_package: Cisco-FirePOWER-1.0 + device_folders: + - name: DeviceRegConfig + key: DeviceRegConfig + device_params: + - name: ac_policy + key: ac_policy + value: Default Access Control + physical_domain: phys + #vmm_provider: VMware + #vmm_domain: my_firepower_domain + devices: + - name: my_device + #vmName: Virtual3D64 + #vcenterName: my_vCenter + #vmm_controller: my_vCenter + device_username: admin + device_password: device_password_1 + device_ip: 10.10.10.2 + device_port: 443 + # device_folders: + # - name: DeviceRegConfig + # key: DeviceRegConfig + # device_params: + # - name: ac_policy + # key: ac_policy + # value: Default Access Control + # - name: + # key: + # value: + # device_folders: + # - name: + # key: + # device_params: + # device_folders: + concrete_interfaces: + - name: internalcinf + #vnicName: Network adapter 2 + path: "topology/pod-1/paths-1001/pathep-[eth1/11]" + - name: externalcinf + #vnicName: Network adapter 3 + path: "topology/pod-1/paths-1001/pathep-[eth1/12]" + - name: my_device_2 + #vmName: Virtual3D64 + #vcenterName: my_vCenter + #vmm_controller: my_vCenter + device_username: admin + device_password: device_password_2 + device_ip: 10.10.10.3 + device_port: 443 + concrete_interfaces: + - name: internalcinf + #vnicName: Network adapter 4 + path: "topology/pod-1/paths-1001/pathep-[eth1/11]" + - name: externalcinf + #vnicName: Network adapter 5 + path: "topology/pod-1/paths-1001/pathep-[eth1/12]" + logical_interfaces: + - name: internal + label: internal + device: my_device + concrete_interface: internalcinf + - name: internal + label: internal + device: my_device_2 + concrete_interface: internalcinf + - name: external + label: external + device: my_device + concrete_interface: externalcinf + - name: external + label: external + device: my_device_2 + concrete_interface: externalcinf \ No newline at end of file