Clean up old dse codes in Policy Engine
This removes unnecessary codes for dse2 architecture in policy engine. Change-Id: I56bfca19f99edcb80b1d23b6b08cb8a10f914261 Partial-bug: #1616339
This commit is contained in:
parent
c942d89503
commit
9338f3f367
@ -478,6 +478,12 @@ class Runtime (object):
|
||||
name='rule_syntax')
|
||||
return changes
|
||||
|
||||
def process_policy_update(self, events, persistent=False):
|
||||
LOG.debug("process_policy_update %s" % events)
|
||||
# body_only so that we don't subscribe to tables in the head
|
||||
result = self.update(events, persistent=persistent)
|
||||
return result
|
||||
|
||||
##########################
|
||||
# Non-persistence layer
|
||||
##########################
|
||||
@ -1708,10 +1714,6 @@ class ExperimentalRuntime (Runtime):
|
||||
##############################################################################
|
||||
|
||||
|
||||
def d6service(name, keys, inbox, datapath, args):
|
||||
return DseRuntime(name, keys, inbox, datapath, args)
|
||||
|
||||
|
||||
class PolicySubData (object):
|
||||
def __init__(self, trigger):
|
||||
self.table_trigger = trigger
|
||||
@ -1821,7 +1823,8 @@ class DseRuntime (Runtime, deepsix.deepSix):
|
||||
self.log("process_policy_update %s" % events)
|
||||
# body_only so that we don't subscribe to tables in the head
|
||||
oldtables = self.tablenames(body_only=True)
|
||||
result = self.update(events, persistent=persistent)
|
||||
result = Runtime.process_policy_update(self, events,
|
||||
persistent=persistent)
|
||||
newtables = self.tablenames(body_only=True)
|
||||
self.update_table_subscriptions(oldtables, newtables)
|
||||
return result
|
||||
|
@ -22,11 +22,12 @@ import datetime
|
||||
import mock
|
||||
from mox3 import mox
|
||||
import neutronclient.v2_0.client
|
||||
from oslo_config import cfg
|
||||
from six.moves import range
|
||||
|
||||
from congress.datalog import compile
|
||||
from congress.datasources import neutron_driver
|
||||
from congress.dse import d6cage
|
||||
from congress import harness
|
||||
from congress.tests import base
|
||||
from congress.tests import helper
|
||||
|
||||
@ -280,7 +281,9 @@ class TestDataSourceDriver(base.TestCase):
|
||||
def setUp(self):
|
||||
"""Setup polling tests."""
|
||||
super(TestDataSourceDriver, self).setUp()
|
||||
cage = d6cage.d6Cage()
|
||||
cfg.CONF.set_override(
|
||||
'drivers',
|
||||
['congress.datasources.neutron_driver.NeutronDriver'])
|
||||
|
||||
# Create mock of Neutron client so we can control data
|
||||
mock_factory = mox.Mox()
|
||||
@ -298,29 +301,32 @@ class TestDataSourceDriver(base.TestCase):
|
||||
security_group_response)
|
||||
mock_factory.ReplayAll()
|
||||
|
||||
# Create modules (without auto-polling)
|
||||
cage.loadModule("NeutronDriver",
|
||||
helper.data_module_path("neutron_driver.py"))
|
||||
cage.loadModule("PolicyDriver", helper.policy_module_path())
|
||||
cage.createservice(name="policy", moduleName="PolicyDriver",
|
||||
args={'d6cage': cage,
|
||||
'rootdir': helper.data_module_path(''),
|
||||
'log_actions_only': True})
|
||||
args = helper.datasource_openstack_args()
|
||||
args['poll_time'] = 0
|
||||
args['client'] = neutron_client
|
||||
cage.createservice(name="neutron", moduleName="NeutronDriver",
|
||||
args=args)
|
||||
policy = cage.service_object('policy')
|
||||
policy.create_policy('neutron')
|
||||
policy.set_schema(
|
||||
'neutron', cage.service_object('neutron').get_schema())
|
||||
cage.service_object('neutron').neutron = neutron_client
|
||||
policy.debug_mode()
|
||||
node = helper.make_dsenode_new_partition('neutron_ds_node')
|
||||
|
||||
engine = harness.create_policy_engine()
|
||||
node.register_service(engine)
|
||||
|
||||
neutron_args = {
|
||||
'name': 'neutron',
|
||||
'driver': 'neutron',
|
||||
'description': None,
|
||||
'type': None,
|
||||
'enabled': '1'
|
||||
}
|
||||
neutron_args['config'] = helper.datasource_openstack_args()
|
||||
neutron_args['config']['poll_time'] = 0
|
||||
neutron_args['config']['client'] = neutron_client
|
||||
neutron_ds = node.create_datasource_service(neutron_args)
|
||||
node.register_service(neutron_ds)
|
||||
|
||||
engine.create_policy('neutron')
|
||||
engine.set_schema('neutron', neutron_ds.get_schema())
|
||||
neutron_ds.neutron = neutron_client
|
||||
engine.debug_mode()
|
||||
|
||||
# insert rule into policy to make testing easier.
|
||||
# (Some of the IDs are auto-generated each time we convert)
|
||||
policy.insert(create_network_group('p'))
|
||||
engine.insert(create_network_group('p'))
|
||||
|
||||
# create some garbage data
|
||||
args = helper.datasource_openstack_args()
|
||||
@ -350,15 +356,15 @@ class TestDataSourceDriver(base.TestCase):
|
||||
|
||||
# return value
|
||||
self.info = {}
|
||||
self.info['cage'] = cage
|
||||
self.info['node'] = node
|
||||
self.info['datalog1'] = datalog1
|
||||
self.info['datalog2'] = datalog2
|
||||
self.info['fake_networks'] = fake_networks
|
||||
|
||||
def test_last_updated(self):
|
||||
"""Test the last_updated timestamping."""
|
||||
cage = self.info['cage']
|
||||
neutron = cage.service_object('neutron')
|
||||
node = self.info['node']
|
||||
neutron = node.service_object('neutron')
|
||||
|
||||
# initial value
|
||||
last_updated = neutron.get_last_updated_time()
|
||||
|
@ -32,7 +32,6 @@ from congress.policy_engines import agnostic
|
||||
from congress.tests import base
|
||||
from congress.tests import helper
|
||||
|
||||
import congress.dse.d6cage
|
||||
|
||||
LOG = logging.getLogger(__name__)
|
||||
|
||||
@ -1618,16 +1617,7 @@ class TestDisabledRules(base.SqlTestCase):
|
||||
late-arriving schema when importing rules already in DB.
|
||||
This behavior is not necessary in persistent_insert.
|
||||
"""
|
||||
# FIXME(ekcs): test at Runtime level rather than DseRuntime level.
|
||||
# temporarily test on DseRuntime because the persistence layer of
|
||||
# Runtime depends on DseRuntime
|
||||
cage = congress.dse.d6cage.d6Cage()
|
||||
cage.loadModule("TestPolicy", helper.policy_module_path())
|
||||
cage.createservice(name="policy", moduleName="TestPolicy",
|
||||
args={'d6cage': cage, 'rootdir': '',
|
||||
'log_actions_only': True})
|
||||
run = cage.services['policy']['object']
|
||||
|
||||
run = agnostic.Runtime()
|
||||
run.create_policy('data', kind=datalog_base.DATASOURCE_POLICY_TYPE)
|
||||
run.persistent_create_policy('policy')
|
||||
obj = run.policy_object('policy')
|
||||
|
Loading…
Reference in New Issue
Block a user