Ejemplo n.º 1
0
 def create_bgpaas(self):
     proj = self.api.project_read(
         fq_name=["default-domain", "default-project"])
     bgpaas_obj = BgpAsAService(name='bgpaas_update', parent_obj=proj)
     # Set a valid ASN and create bgpaas object
     bgpaas_obj.autonomous_system = 64512
     bgpaas_uuid = self.api.bgp_as_a_service_create(bgpaas_obj)
     return bgpaas_uuid, bgpaas_obj
Ejemplo n.º 2
0
 def test_bgpaas_create_within_invalid_2_byte_asn(self):
     proj = self.api.project_read(
         fq_name=["default-domain", "default-project"])
     bgpaas_obj = BgpAsAService(name='bgpaas',
                                parent_obj=proj)
     # Set a invalid ASN and create bgpaas object
     bgpaas_obj.autonomous_system = 700000
     self.assertRaises(BadRequest, self.api.bgp_as_a_service_create,
                       bgpaas_obj)
Ejemplo n.º 3
0
    def test_bgpaas_create_with_valid_2_byte_asn(self):
        proj = self.api.project_read(
            fq_name=["default-domain", "default-project"])
        bgpaas_obj = BgpAsAService(name='bgpaas',
                                   parent_obj=proj)
        # Set a valid ASN and create bgpaas object
        bgpaas_obj.autonomous_system = 64512
        bgpaas_uuid = self.api.bgp_as_a_service_create(bgpaas_obj)

        # Now delete the bgpaas object
        self.api.bgp_as_a_service_delete(id=bgpaas_uuid)
Ejemplo n.º 4
0
    def create_bgpaas_with_local_asn(self):
        proj = self.api.project_read(
            fq_name=["default-domain", "default-project"])
        bgp_session_attr = BgpSessionAttributes(local_autonomous_system=64500)

        bgpaas_obj = BgpAsAService(name='bgpaas',
                                   parent_obj=proj,
                                   bgpaas_session_attributes=bgp_session_attr)

        bgpaas_obj.autonomous_system = 64512
        bgpaas_uuid = self.api.bgp_as_a_service_create(bgpaas_obj)
        return bgpaas_uuid, bgpaas_obj
Ejemplo n.º 5
0
    def test_bgpaas_create_with_invalid_2_byte_local_asn(self):
        proj = self.api.project_read(
            fq_name=["default-domain", "default-project"])

        # Set a invalid Local ASN and create bgpaas object
        bgp_session_attr = BgpSessionAttributes(local_autonomous_system=700001)

        bgpaas_obj = BgpAsAService(name='bgpaas',
                                   parent_obj=proj,
                                   bgpaas_session_attributes=bgp_session_attr)
        bgpaas_obj.autonomous_system = 64512
        self.assertRaises(BadRequest, self.api.bgp_as_a_service_create,
                          bgpaas_obj)
Ejemplo n.º 6
0
    def test_bgpaas_create_with_invalid_4_byte_asn(self):
        gsc = self.api.global_system_config_read(GlobalSystemConfig().fq_name)
        # Enable 4 byte ASN flag in GSC
        gsc.enable_4byte_as = True
        self.api.global_system_config_update(gsc)

        proj = self.api.project_read(
            fq_name=["default-domain", "default-project"])
        bgpaas_obj = BgpAsAService(name='bgpaas', parent_obj=proj)
        # Set a invalid ASN and create bgpaas object
        bgpaas_obj.autonomous_system = 0x1FFFFFFFF
        self.assertRaises(BadRequest, self.api.bgp_as_a_service_create,
                          bgpaas_obj)

        # Finally, disable 4 byte ASN flag
        gsc.enable_4byte_as = False
        self.api.global_system_config_update(gsc)
Ejemplo n.º 7
0
    def test_bgpaas_create_with_valid_4_byte_asn(self):
        gsc = self.api.global_system_config_read(GlobalSystemConfig().fq_name)
        # Enable 4 byte ASN flag in GSC
        gsc.enable_4byte_as = True
        self.api.global_system_config_update(gsc)

        proj = self.api.project_read(
            fq_name=["default-domain", "default-project"])
        bgpaas_obj = BgpAsAService(name='bgpaas',
                                   parent_obj=proj)
        # Set a valid ASN and create bgpaas object
        bgpaas_obj.autonomous_system = 700000
        bgpaas_uuid = self.api.bgp_as_a_service_create(bgpaas_obj)

        # Now delete the bgpaas object and disable 4 byte ASN flag
        self.api.bgp_as_a_service_delete(id=bgpaas_uuid)
        gsc.enable_4byte_as = False
        self.api.global_system_config_update(gsc)