Esempio n. 1
0
    def setUp(self):
        super(Nsxv3FwaasTestCase, self).setUp()
        self.firewall = edge_fwaas_driver_v2.EdgeFwaasV3DriverV2()

        # Start some nsxlib/DB mocks
        mock.patch(
            "vmware_nsxlib.v3.core_resources.NsxLibLogicalRouter."
            "get_firewall_section_id",
            return_value=MOCK_SECTION_ID).start()

        mock.patch(
            "vmware_nsxlib.v3.security.NsxLibFirewallSection."
            "get_default_rule",
            return_value={
                'id': MOCK_DEFAULT_RULE_ID
            }).start()

        mock.patch("vmware_nsx.db.db.get_nsx_router_id",
                   return_value=MOCK_NSX_ID).start()

        self.plugin = directory.get_plugin()
        self.plugin.fwaas_callbacks = fwaas_callbacks_v2.\
            Nsxv3FwaasCallbacksV2(self.plugin.nsxlib)
        self.plugin.fwaas_callbacks.fwaas_enabled = True
        self.plugin.fwaas_callbacks.fwaas_driver = self.firewall
Esempio n. 2
0
    def __init__(self):
        super(EdgeFwaasTVDriverV2, self).__init__()
        self.driver_name = FWAAS_DRIVER_NAME

        # supported drivers (Only NSX-T):
        self.drivers = {}
        try:
            self.drivers[projectpluginmap.NsxPlugins.NSX_T] = (
                t_driver.EdgeFwaasV3DriverV2())
        except Exception:
            LOG.warning("EdgeFwaasTVDriverV2 failed to initialize the NSX-T "
                        "driver")
            self.drivers[projectpluginmap.NsxPlugins.NSX_T] = None