예제 #1
0
    def test_object_version_degradation_1_3_to_1_2(self):
        drivers_obj = rule_type.QosRuleTypeDriver(name="backend_driver",
                                                  supported_parameters=[{}])
        qos_rule_type = rule_type.QosRuleType(
            type=qos_consts.RULE_TYPE_BANDWIDTH_LIMIT, drivers=[drivers_obj])

        rule_type_v1_2 = self._policy_through_version(qos_rule_type, '1.2')
        self.assertNotIn("drivers", rule_type_v1_2)
        self.assertIn("type", rule_type_v1_2)
예제 #2
0
    def test_object_version(self):
        qos_rule_type = rule_type.QosRuleType()
        rule_type_v1_1 = self._policy_through_version(qos_rule_type, '1.1')

        self.assertIn(
            qos_consts.RULE_TYPE_BANDWIDTH_LIMIT,
            tuple(rule_type_v1_1.fields['type'].AUTO_TYPE._valid_values))
        self.assertIn(
            qos_consts.RULE_TYPE_DSCP_MARKING,
            tuple(rule_type_v1_1.fields['type'].AUTO_TYPE._valid_values))
예제 #3
0
 def test_object_version_degradation_less_than_1_3(self):
     qos_rule_type = rule_type.QosRuleType()
     self.assertRaises(exception.IncompatibleObjectVersion,
                       qos_rule_type.obj_to_primitive, '1.2')