def verify_attribute_range(self):

        info("\n########## Test to verify attribute ranges ##########\n")

        info("\nAttempting to create a port with out of range values in "
             "attributes\n")

        interfaces_out_of_range = []
        for i in range(1, 10):
            interfaces_out_of_range.append("/rest/v1/system/interfaces/%s" % i)

        data = [("ip4_address", "175.167.134.123/248", httplib.BAD_REQUEST),
                ("ip4_address", "175.167.134.123/24", httplib.CREATED),
                ("vlan_tag", ["/rest/v1/system/bridges/bridge_normal/vlans/VLAN4095"], httplib.BAD_REQUEST),
                ("vlan_tag", ["/rest/v1/system/bridges/bridge_normal/vlans/VLAN675"], httplib.CREATED),
                ("interfaces", interfaces_out_of_range, httplib.BAD_REQUEST),
                ("interfaces", ["/rest/v1/system/interfaces/1"],
                 httplib.CREATED)]
        results = execute_port_operations(data, "PortRangesTest", "POST",
                                          self.PATH, self.SWITCH_IP,
                                          self.cookie_header)

        assert results, "Unable to execute requests in verify_attribute_range"

        for attribute in results:
            assert attribute[1], "%s code issued " % attribute[2] + \
                "instead of %s for value range " % attribute[3] + \
                "test in field '%s'" % attribute[0]
            info("%s code received as expected for field %s!\n" %
                 (attribute[2], attribute[0]))

        info("\n########## End test to verify attribute ranges ##########\n")
    def verify_unknown_attribute(self):

        info("\n########## Test to verify unkown attribute ##########\n")

        info("\nAttempting to modify a port with an unknown attribute\n")

        data = [
            ("unknown_attribute", "unknown_value", httplib.BAD_REQUEST),
            ("vlan_mode", "access", httplib.OK)
        ]
        results = execute_port_operations(data, "PortUnknownAttributeTest",
                                          "PUT", self.PATH, self.SWITCH_IP,
                                          self.cookie_header)

        assert results, \
            "Unable to execute requests in verify_unknown_attribute"

        for attribute in results:
            assert attribute[1], "%s code issued " % attribute[2] + \
                "instead of %s for unknown " % attribute[3] + \
                "attribute test in field '%s'" % attribute[0]
            info("%s code received as expected for field %s!\n" %
                 (attribute[2], attribute[0]))

        info("\n########## End test to verify unkown attribute ##########\n")
    def verify_attribute_type(self):

        info("\n########## Test to verify attribute types ##########\n")

        info("\nAttempting to create port with incorrect type in attributes\n")

        bridge_path = "/rest/v1/system/bridges"
        vlan_id = 675
        vlan_name = "VLAN675"
        vlan_path = "%s/%s/vlans" % (bridge_path, DEFAULT_BRIDGE)

        create_fake_vlan(vlan_path, self.SWITCH_IP, vlan_name, vlan_id)
        data = [("ip4_address", 192, httplib.BAD_REQUEST),
                ("ip4_address", "192.168.0.1/24", httplib.CREATED),
                ("vlan_tag", ["/rest/v1/system/bridges/bridge_normal/vlans/VLAN345"], httplib.BAD_REQUEST),
                ("vlan_tag", ["/rest/v1/system/bridges/bridge_normal/vlans/VLAN675"], httplib.CREATED),
                ("vlan_trunks", ["/rest/v1/system/bridges/bridge_normal/vlans/VLAN345", "/rest/v1/system/bridges/bridge_normal/vlans/VLAN346"], httplib.BAD_REQUEST),
                ("vlan_trunks", ["/rest/v1/system/bridges/bridge_normal/vlans/VLAN654", "/rest/v1/system/bridges/bridge_normal/vlans/VLAN675"], httplib.CREATED)]
        results = execute_port_operations(data, "PortTypeTest", "POST",
                                          self.PATH, self.SWITCH_IP,
                                          self.cookie_header)

        assert results, "Unable to execute requests in verify_attribute_type"

        for attribute in results:
            assert attribute[1], "%s code issued " % attribute[2] + \
                "instead of %s for type " % attribute[3] + \
                "test in field '%s'" % attribute[0]
            info("%s code received as expected for field %s!\n" %
                 (attribute[2], attribute[0]))

        info("\n########## End test to verify attribute types ##########\n")
    def verify_attribute_type(self):

        info("\n########## Test to verify attribute types ##########\n")

        info("\nAttempting to modify a port with incorrect types in \
            attributes\n")

        data = [("ip4_address", 192, httplib.BAD_REQUEST),
                ("ip4_address", "192.168.0.1", httplib.OK),
                ("tag", "675", httplib.BAD_REQUEST),
                ("tag", 675, httplib.OK),
                ("trunks", "654, 675", httplib.BAD_REQUEST),
                ("trunks", [654, 675], httplib.OK)]
        results = execute_port_operations(data, "PortTypeTest", "PUT",
                                          self.PATH, self.SWITCH_IP,
                                          self.cookie_header)

        assert results, "Unable to execute requests in verify_attribute_type"

        for attribute in results:
            assert attribute[1], "%s code issued " % attribute[2] + \
                "instead of %s for type " % attribute[3] + \
                "test in field '%s'" % attribute[0]
            info("%s code received as expected for field %s!\n" %
                 (attribute[2], attribute[0]))
            assert attribute[1], "{0} code issued instead of {2} for type \
                test in field '{1}'".format(attribute[2], attribute[0],
                                            attribute[3])
            info("{0} code received as expected for field {1}!\n".format
                 (attribute[2], attribute[0]))

        info("\n########## End test to verify attribute types ##########\n")
    def verify_attribute_value(self):

        info("\n########## Test to verify attribute valid value ##########\n")

        info("\nAttempting to create port with invalid value in attributes\n")

        data = [("vlan_mode", "invalid_value", httplib.BAD_REQUEST),
                ("vlan_mode", "access", httplib.CREATED)]

        results = execute_port_operations(data, "PortValidValueTest", "POST",
                                          self.PATH, self.SWITCH_IP,
                                          self.cookie_header)

        assert results, "Unable to execute requests in verify_attribute_value"

        for attribute in results:
            assert attribute[1], "%s code issued " % attribute[2] + \
                "instead of %s for attribute " % attribute[3] + \
                "valid value test in field '%s'" % attribute[0]
            info("%s code received as expected for field %s!\n" %
                 (attribute[2], attribute[0]))

        info("\n########## End test to verify attribute valid value "
             "##########\n")