'Create necessary mock varibles for instance_rules.
The i_mock and ni_mock represent instance_rules parameters
instance and network_info.
The i_obj_mock represent the return vaue for nova.objects.Instance.'

def setup_instance_rules(self, ins_obj_cls_mock):

    i_mock = mock.MagicMock(spec=dict)
    ni_mock = mock.MagicMock(spec=dict)
    i_obj_mock = mock.MagicMock()
    ins_obj_cls_mock._from_db_object.return_value = i_obj_mock
    driver = firewall.IptablesFirewallDriver()
    return (i_mock, ni_mock, i_obj_mock, driver)
