def mac_address(self, address: str): """ Set MAC address on interface. :param address: MAC address :raises CX: """ address = validate.mac_address(address) if address == "random": address = utils.get_random_mac(self.__api) if address != "" and not self.__api.settings().allow_duplicate_macs: matched = self.__api.find_items("system", {"mac_address": address}) if len(matched) > 0: raise ValueError("MAC address duplicated: %s" % address) self._mac_address = address
def set_mac_address(self, address, interface): """ Set mac address on interface. @param: str address (mac address) @param: str interface (interface name) @returns: True or CX """ address = validate.mac_address(address) if address == "random": address = utils.get_random_mac(self.collection_mgr.api) if address != "" and utils.input_boolean(self.collection_mgr._settings.allow_duplicate_macs) is False: matched = self.collection_mgr.api.find_items("system", {"mac_address": address}) for x in matched: if x.name != self.name: raise CX("MAC address duplicated: %s" % address) intf = self.__get_interface(interface) intf["mac_address"] = address
def set_mac_address(self, address, interface): """ Set mac address on interface. @param: str address (mac address) @param: str interface (interface name) @returns: True or CX """ address = validate.mac_address(address) if address == "random": address = utils.get_random_mac(self.collection_mgr.api) if address != "" and utils.input_boolean(self.collection_mgr._settings.allow_duplicate_macs) is False: matched = self.collection_mgr.api.find_items("system", {"mac_address": address}) for x in matched: if x.name != self.name: raise CX("MAC address duplicated: %s" % address) intf = self.__get_interface(interface) intf["mac_address"] = address
def set_mac_address(self, address: str, interface: str): """ Set MAC address on interface. :param address: MAC address :param interface: interface name :returns: True or CX """ address = validate.mac_address(address) if address == "random": address = utils.get_random_mac(self.collection_mgr.api) if address != "" and self.collection_mgr.settings( ).allow_duplicate_macs is False: matched = self.collection_mgr.api.find_items( "system", {"mac_address": address}) for x in matched: if x.name != self.name: raise CX("MAC address duplicated: %s" % address) intf = self.__get_interface(interface) intf["mac_address"] = address