示例#1
0
文件: brocade.py 项目: djfinn14/hil
    def validate_port_name(port):
        """Valid port names for this switch are of the form 1/0/1 or 1/2"""

        val = re.compile(r'^\d+/\d+(/\d+)?$')
        if not val.match(port):
            raise BadArgumentError("Invalid port name. Valid port names for "
                                   "this switch are of the from 1/0/1 or 1/2")
        return
示例#2
0
    def validate_port_name(port):
        """
        Valid port names for this switch are of the form gi1/0/11,
        te1/0/12, gi1/12, or te1/3
        """

        val = re.compile(r'^(gi|te)\d+/\d+(/\d+)?$')
        if not val.match(port):
            raise BadArgumentError("Invalid port name. Valid port names for "
                                   "this switch are of the form gi1/0/11, "
                                   "te1/0/12, gi1/12, or te1/3")
        return
示例#3
0
文件: nexus.py 项目: razaaliraza/hil
    def validate_port_name(port):
        """
        Valid port names for this switch are of the form: Ethernet1/12,
        ethernet1/12, Ethernet1/0/10, or ethernet1/0/10
        """

        val = re.compile(r'^(E|e)thernet\d+/\d+(/\d+)?$')
        if not val.match(port):
            raise BadArgumentError("Invalid port name. Valid port names for "
                                   "this switch are of the form: Ethernet1/12"
                                   " ethernet1/12, Ethernet1/0/10, or"
                                   " ethernet1/0/10")
        return
示例#4
0
文件: ipmi.py 项目: djfinn14/hil
 def require_legal_bootdev(self, dev):
     if dev not in self.valid_bootdevices:
         raise BadArgumentError('Invald boot device')
示例#5
0
def check_reserved(obj_type, obj_string, slashes_ok=False):
    """Check for illegal characters and report of their existence"""
    bad_chars = _find_reserved(obj_string, slashes_ok)
    if bool(bad_chars):
        error = obj_type + " may not contain: " + str(bad_chars)
        raise BadArgumentError(error)