Esempio n. 1
0
    def test_get_undo_recipe(self):

        # Test Action
        action_steps = RaiseAlarm.get_undo_recipe(self.action_spec)

        # Test Assertions

        # expecting for one step: [remove_vertex]
        self.assertEqual(1, len(action_steps))

        self.assertEqual(REMOVE_VERTEX, action_steps[0].type)
        remove_vertex_step_params = action_steps[0].params

        # remove_vertex expects four params: alarm name, state, target,
        # and type
        self.assertEqual(4, len(remove_vertex_step_params))

        alarm_name = remove_vertex_step_params[TFields.ALARM_NAME]
        self.assertEqual(self.props[TFields.ALARM_NAME], alarm_name)

        target_vitrage_id = remove_vertex_step_params[TFields.TARGET]
        self.assertEqual(self.target_vertex.vertex_id, target_vitrage_id)

        alarm_state = remove_vertex_step_params[TFields.STATE]
        self.assertEqual(alarm_state, AlarmProperties.INACTIVE_STATE)

        alarm_vitrage_resource_type = \
            remove_vertex_step_params[VProps.VITRAGE_RESOURCE_TYPE]
        self.assertEqual(self.target_vertex.properties[VProps.VITRAGE_TYPE],
                         alarm_vitrage_resource_type)
Esempio n. 2
0
    def test_get_do_recipe(self):

        # Test Action
        action_steps = RaiseAlarm.get_do_recipe(self.action_spec)

        # Test Assertions

        # expecting for one step: [add_vertex]
        self.assertEqual(1, len(action_steps))

        self.assertEqual(ADD_VERTEX, action_steps[0].type)
        add_vertex_step_params = action_steps[0].params
        self.assertEqual(4, len(add_vertex_step_params))

        alarm_name = add_vertex_step_params[TFields.ALARM_NAME]
        self.assertEqual(self.props[TFields.ALARM_NAME], alarm_name)

        target_vitrage_id = add_vertex_step_params[TFields.TARGET]
        self.assertEqual(self.target_vertex.vertex_id, target_vitrage_id)

        alarm_state = add_vertex_step_params[TFields.STATE]
        self.assertEqual(alarm_state, AlarmProperties.ACTIVE_STATE)

        alarm_vitrage_resource_type = \
            add_vertex_step_params[VProps.VITRAGE_RESOURCE_TYPE]
        self.assertEqual(self.target_vertex.properties[VProps.VITRAGE_TYPE],
                         alarm_vitrage_resource_type)
Esempio n. 3
0
    def test_get_do_recipe(self):

        # Test Action
        action_steps = RaiseAlarm.get_do_recipe(self.action_spec)

        # Test Assertions

        # expecting for one step: [add_vertex]
        self.assertEqual(1, len(action_steps))

        self.assertEqual(ADD_VERTEX, action_steps[0].type)
        add_vertex_step_params = action_steps[0].params
        self.assertEqual(3, len(add_vertex_step_params))

        alarm_name = add_vertex_step_params[TFields.ALARM_NAME]
        self.assertEqual(self.props[TFields.ALARM_NAME], alarm_name)

        target_vitrage_id = add_vertex_step_params[TFields.TARGET]
        self.assertEqual(self.target_vertex_id, target_vitrage_id)

        alarm_state = add_vertex_step_params[TFields.STATE]
        self.assertEqual(alarm_state, AlarmProperties.ALARM_ACTIVE_STATE)
Esempio n. 4
0
    def test_get_undo_recipe(self):

        # Test Action
        action_steps = RaiseAlarm.get_undo_recipe(self.action_spec)

        # Test Assertions

        # expecting for one step: [remove_vertex]
        self.assertEqual(1, len(action_steps))

        self.assertEqual(REMOVE_VERTEX, action_steps[0].type)
        remove_vertex_step_params = action_steps[0].params

        # remove_vertex expects three params: alarm name, state and target
        self.assertEqual(3, len(remove_vertex_step_params))

        alarm_name = remove_vertex_step_params[TFields.ALARM_NAME]
        self.assertEqual(self.props[TFields.ALARM_NAME], alarm_name)

        target_vitrage_id = remove_vertex_step_params[TFields.TARGET]
        self.assertEqual(self.target_vertex.vertex_id, target_vitrage_id)

        alarm_state = remove_vertex_step_params[TFields.STATE]
        self.assertEqual(alarm_state, AlarmProperties.ALARM_INACTIVE_STATE)
Esempio n. 5
0
    def test_get_undo_recipe(self):

        # Test Action
        action_steps = RaiseAlarm.get_undo_recipe(self.action_spec)

        # Test Assertions

        # expecting for one step: [remove_vertex]
        self.assertEqual(1, len(action_steps))

        self.assertEqual(REMOVE_VERTEX, action_steps[0].type)
        remove_vertex_step_params = action_steps[0].params

        # remove_vertex expects three params: alarm name, state and target
        self.assertEqual(3, len(remove_vertex_step_params))

        alarm_name = remove_vertex_step_params[TFields.ALARM_NAME]
        self.assertEqual(self.props[TFields.ALARM_NAME], alarm_name)

        target_vitrage_id = remove_vertex_step_params[TFields.TARGET]
        self.assertEqual(self.target_vertex_id, target_vitrage_id)

        alarm_state = remove_vertex_step_params[TFields.STATE]
        self.assertEqual(alarm_state, AlarmProperties.ALARM_INACTIVE_STATE)