def setUp(self): VncApiMock.init() DBMock.init() vnc_kubernetes.VncKubernetes.reset() self.args = Mock() self.args.admin_user = "******" self.args.admin_password = "******" self.args.admin_tenant = "default" self.args.vnc_endpoint_ip = '127.0.0.1' self.args.vnc_endpoint_port = "8082" self.args.auth_token_url = "token" self.args.cluster_project = None self.args.cluster_network = None self.args.cluster_pod_network = None self.args.cluster_service_network = None self.args.pod_subnets = ['10.10.0.0/16'] self.args.service_subnets = ['192.168.0.0/24'] self.args.kubernetes_api_secure_port = "8443" self.args.auth_user = "******" self.args.auth_password = "******" self.args.auth_tenant = "default" self.args.cassandra_server_list = () api = VncApiMock(self.args.auth_user, self.args.auth_password, self.args.auth_tenant, self.args.vnc_endpoint_ip, self.args.vnc_endpoint_port, self.args.auth_token_url) domain_uuid = api.domain_create(Domain("default-domain")) domain = api.domain_read(id=domain_uuid) proj_uuid = api.project_create( Project("default-project", parent_obj=domain)) proj = api.project_read(id=proj_uuid) net = VirtualNetwork("ip-fabric", proj) api.virtual_network_create(net)
def test_resources_exists(self): api = VncApiMock(self.args.auth_user, self.args.auth_password, self.args.auth_tenant, self.args.vnc_endpoint_ip, self.args.vnc_endpoint_port, self.args.auth_token_url) domain_uuid = api.domain_create(Domain("default-domain")) domain = api.domain_read(id=domain_uuid) proj_uuid = api.project_create(Project("default", parent_obj=domain)) proj = api.project_read(id=proj_uuid) ipam_uuid = api.network_ipam_create(NetworkIpam("pod-ipam", proj)) ipam = api.network_ipam_read(id=ipam_uuid) net = VirtualNetwork("cluster-network", proj) net.add_network_ipam(ipam, VnSubnetsType([])) api.virtual_network_create(net) vnc_kubernetes.VncKubernetes(self.args, Mock())
def verify_if_created(self, res_type, name, parent_fq_name): obj = VncApiMock.read(res_type, fq_name=parent_fq_name+[name]) self.assertEquals(name, obj.name) uuid = obj.uuid ok, obj_list = DBMock.read(res_type.replace('-', '_'), [uuid]) self.assertEquals(True, ok) self.assertEquals(parent_fq_name+[name], obj_list[0]['fq_name']) return obj
def setUp(self): VncApiMock.init() DBMock.init() vnc_kubernetes.VncKubernetes.reset() self.args = Mock() self.args.admin_user = "******" self.args.admin_password = "******" self.args.admin_tenant = "default" self.args.vnc_endpoint_ip = '127.0.0.1' self.args.vnc_endpoint_port = "8082" self.args.auth_token_url = "token" self.args.cluster_project = None self.args.cluster_network = None self.args.pod_subnets = ['10.10.0.0/16'] self.args.service_subnets = ['192.168.0.0/24'] self.args.kubernetes_api_secure_port = "8443" self.args.auth_user = "******" self.args.auth_password = "******" self.args.auth_tenant = "default" self.args.cassandra_server_list = ()
def setUp(self): VncApiMock.init() DBMock.init() vnc_kubernetes.VncKubernetes.reset() self.args = Mock() self.args.admin_user = "******" self.args.admin_password = "******" self.args.admin_tenant = "default" self.args.vnc_endpoint_ip = '127.0.0.1' self.args.vnc_endpoint_port = "8082" self.args.auth_token_url = "token" self.args.cluster_project = None self.args.cluster_network = None self.args.cluster_pod_network = None self.args.cluster_service_network = None self.args.cluster_name = "cluster" self.args.pod_subnets = ['10.10.0.0/16'] self.args.ip_fabric_subnets = ['20.20.0.0/16'] self.args.service_subnets = ['192.168.0.0/24'] self.args.kubernetes_api_secure_port = "8443" self.args.auth_user = "******" self.args.auth_password = "******" self.args.auth_tenant = "default" self.args.cassandra_server_list = () self.args.aps_name="test-aps" self.args.rabbit_port = None self.args.collectors = "" api = VncApiMock( self.args.auth_user, self.args.auth_password, self.args.auth_tenant, self.args.vnc_endpoint_ip, self.args.vnc_endpoint_port, self.args.auth_token_url ) domain_uuid = api.domain_create(Domain("default-domain")) domain = api.domain_read(id=domain_uuid) proj_uuid = api.project_create(Project("default-project", parent_obj=domain)) proj = api.project_read(id=proj_uuid) net = VirtualNetwork("ip-fabric", proj) api.virtual_network_create(net)
def test_resources_exists(self): api = VncApiMock( self.args.auth_user, self.args.auth_password, self.args.auth_tenant, self.args.vnc_endpoint_ip, self.args.vnc_endpoint_port, self.args.auth_token_url ) domain_uuid = api.domain_create(Domain("default-domain")) domain = api.domain_read(id=domain_uuid) proj_uuid = api.project_create(Project("default", parent_obj=domain)) proj = api.project_read(id=proj_uuid) ipam_uuid = api.network_ipam_create(NetworkIpam("pod-ipam", proj)) ipam = api.network_ipam_read(id=ipam_uuid) net = VirtualNetwork("cluster-network", proj) net.add_network_ipam(ipam, VnSubnetsType([])) api.virtual_network_create(net) vnc_kubernetes.VncKubernetes(self.args, Mock())
def test_resources_exists(self): api = VncApiMock( self.args.auth_user, self.args.auth_password, self.args.auth_tenant, self.args.vnc_endpoint_ip, self.args.vnc_endpoint_port, self.args.auth_token_url ) domain_fq_name = ['default-domain'] domain = api.domain_read(fq_name=domain_fq_name) proj_uuid = api.project_create(Project("default", parent_obj=domain)) proj = api.project_read(id=proj_uuid) # Create cluster-default-pod-network ipam_uuid = api.network_ipam_create(NetworkIpam("pod-ipam", proj)) ipam = api.network_ipam_read(id=ipam_uuid) net = VirtualNetwork("cluster-default-pod-network", proj) # No subnets are associated with IPAM at this point. # Subnets will be updated in the IPAM, when cluster is created. net.add_network_ipam(ipam, VnSubnetsType([])) api.virtual_network_create(net) # Create cluster-default-service-network ipam_uuid = api.network_ipam_create(NetworkIpam("service-ipam", proj)) ipam = api.network_ipam_read(id=ipam_uuid) net = VirtualNetwork("cluster-default-service-network", proj) # No subnets are associated with IPAM at this point. # Subnets will be updated in the IPAM, when cluster is created. net.add_network_ipam(ipam, VnSubnetsType([])) api.virtual_network_create(net) vnc_kubernetes.VncKubernetes(self.args, Mock())