def destination_intf(self, name):
        """
        Associate interface to this rule.

        :param name: (str) Name of interface.
        :return: None
        """
        logging.debug("In destination_intf() for AutoNatRules class.")
        intf_obj = InterfaceObjects(fmc=self.fmc).get()
        items = intf_obj.get("items", [])
        new_intf = None
        for item in items:
            if item["name"] == name:
                new_intf = {"id": item["id"], "type": item["type"]}
                break
        if new_intf is None:
            logging.warning(
                f'Interface Object "{name}" is not found in FMC.  Cannot add to destinationInterface.'
            )
        else:
            if new_intf["type"] == "InterfaceGroup" and len(new_intf.interfaces) > 1:
                logging.warning(
                    f'Interface Object "{name}" contains more than one physical interface. Cannot add to '
                    f"destinationInterface."
                )
            else:
                self.destinationInterface = new_intf
                logging.info(f'Interface Object "{name}" added to NAT Policy.')
Beispiel #2
0
 def destination_intf(self, name):
     logging.debug("In destination_intf() for ManualNatRules class.")
     intf_obj = InterfaceObjects(fmc=self.fmc).get()
     items = intf_obj.get("items", [])
     new_intf = None
     for item in items:
         if item["name"] == name:
             new_intf = {"id": item["id"], "type": item["type"]}
             break
     if new_intf is None:
         logging.warning(
             f'Interface Object "{name}" is not found in FMC.  Cannot add to destinationInterface.'
         )
     else:
         self.destinationInterface = new_intf
         logging.info(f'Interface Object "{name}" added to NAT Policy.')
Beispiel #3
0
 def source_intf(self, name):
     logging.debug("In source_intf() for AutoNatRules class.")
     intf_obj = InterfaceObjects(fmc=self.fmc).get()
     items = intf_obj.get("items", [])
     new_intf = None
     for item in items:
         if item["name"] == name:
             new_intf = {"id": item["id"], "type": item["type"]}
             break
     if new_intf is None:
         logging.warning(
             f'Interface Object "{name}" is not found in FMC.  Cannot add to sourceInterface.'
         )
     else:
         if new_intf["type"] == "InterfaceGroup" and len(new_intf.interfaces) > 1:
             logging.warning(
                 f'Interface Object "{name}" contains more than one physical interface. Cannot add to '
                 f"sourceInterface."
             )
         else:
             self.sourceInterface = new_intf
             logging.info(f'Interface Object "{name}" added to NAT Policy.')
    def source_intf(self, name):
        """
        Associate source interface.

        :param name: (str) Name of interface.
        :return: None
        """
        logging.debug("In source_intf() for ManualNatRules class.")
        intf_obj = InterfaceObjects(fmc=self.fmc).get()
        items = intf_obj.get("items", [])
        new_intf = None
        for item in items:
            if item["name"] == name:
                new_intf = {"id": item["id"], "type": item["type"]}
                break
        if new_intf is None:
            logging.warning(
                f'Interface Object "{name}" is not found in FMC.  Cannot add to sourceInterface.'
            )
        else:
            self.sourceInterface = new_intf
            logging.info(f'Interface Object "{name}" added to NAT Policy.')