def configureProviders(self, phynetwrk, zone): pnetprov = listNetworkServiceProviders.listNetworkServiceProvidersCmd() pnetprov.physicalnetworkid = phynetwrk.id pnetprov.state = "Disabled" pnetprov.name = "VirtualRouter" pnetprovres = self.apiClient.listNetworkServiceProviders(pnetprov) vrprov = listVirtualRouterElements.listVirtualRouterElementsCmd() vrprov.nspid = pnetprovres[0].id vrprovresponse = self.apiClient.listVirtualRouterElements(vrprov) vrprovid = vrprovresponse[0].id vrconfig = configureVirtualRouterElement.configureVirtualRouterElementCmd() vrconfig.enabled = "true" vrconfig.id = vrprovid vrconfigresponse = self.apiClient.configureVirtualRouterElement(vrconfig) if zone.networktype == "Basic" and zone.securitygroupenabled: sgprovider = configGenerator.provider() sgprovider.name = "SecurityGroupProvider" zone.providers.append(sgprovider) for prov in zone.providers: pnetprov = listNetworkServiceProviders.listNetworkServiceProvidersCmd() pnetprov.physicalnetworkid = phynetwrk.id pnetprov.name = prov.name pnetprov.state = "Disabled" pnetprovs = self.apiClient.listNetworkServiceProviders(pnetprov) upnetprov = updateNetworkServiceProvider.updateNetworkServiceProviderCmd() upnetprov.id = pnetprovs[0].id upnetprov.state = "Enabled" upnetprovresponse = self.apiClient.updateNetworkServiceProvider(upnetprov)
def configureProviders(self, phynetwrk, providers, networktype): pnetprov = listNetworkServiceProviders.listNetworkServiceProvidersCmd() pnetprov.physicalnetworkid = phynetwrk[0].id pnetprov.state = 'Enabled' pnetprov.name = 'VirtualRouter' vrprov = self.apiClient.listNetworkServiceProviders(pnetprov) vrprov = listVirtualRouterElements.listVirtualRouterElementsCmd() vrprov.nspid = vrprov.id vrprovresponse = self.apiClient.listVirtualRouterElements(vrprov) vrprovid = vrprovresponse[0].id #Configure VirtualRouter Element vrconfig = configureVirtualRouterElement.configureVirtualRouterElementCmd() vrconfig.enabled = 'true' vrconfig.id = vrprovid vrconfigresponse = self.apiClient.configureVirtualRouterElement(vrconfig) #Enable VirtualRouter provider by default vrprovider = configGenerator.provider() vrprovider.name = 'VirtualRouter' providers.append(vrprovider) #Enable additional providers in this physical network by name for prov in providers: pnetprov = listNetworkServiceProviders.listNetworkServiceProvidersCmd() pnetprov.physicalnetworkid = phynetwrk[0].id pnetprov.name = prov.name pnetprov.state = 'Disabled' pnetprovs = self.apiClient.listNetworkServiceProviders(pnetprov) upnetprov = updateNetworkServiceProvider.updateNetworkServiceProviderCmd() upnetprov.id = pnetprovs[0].id upnetprov.state = 'Enabled' upnetprovresponse = self.apiClient.updateNetworkServiceProvider(upnetprov)
def configureProviders(self, phynetwrk, zone): pnetprov = listNetworkServiceProviders.listNetworkServiceProvidersCmd() pnetprov.physicalnetworkid = phynetwrk.id pnetprov.state = "Disabled" pnetprov.name = "VirtualRouter" pnetprovres = self.apiClient.listNetworkServiceProviders(pnetprov) vrprov = listVirtualRouterElements.listVirtualRouterElementsCmd() vrprov.nspid = pnetprovres[0].id vrprovresponse = self.apiClient.listVirtualRouterElements(vrprov) vrprovid = vrprovresponse[0].id vrconfig = \ configureVirtualRouterElement.configureVirtualRouterElementCmd() vrconfig.enabled = "true" vrconfig.id = vrprovid vrconfigresponse = \ self.apiClient.configureVirtualRouterElement(vrconfig) if zone.networktype == "Basic" and zone.securitygroupenabled: sgprovider = configGenerator.provider() sgprovider.name = "SecurityGroupProvider" zone.providers.append(sgprovider) for prov in zone.providers: pnetprov = \ listNetworkServiceProviders.listNetworkServiceProvidersCmd() pnetprov.physicalnetworkid = phynetwrk.id pnetprov.name = prov.name pnetprov.state = "Disabled" pnetprovs = self.apiClient.listNetworkServiceProviders(pnetprov) upnetprov = \ updateNetworkServiceProvider.updateNetworkServiceProviderCmd() upnetprov.id = pnetprovs[0].id upnetprov.state = "Enabled" upnetprovresponse = \ self.apiClient.updateNetworkServiceProvider(upnetprov)