commit 4893f268020486c7576ec8f3a03ac342d5236b02 Author: Ofer Ben-Yacov Date: Mon Nov 28 12:15:28 2016 +0200 first commit diff --git a/README.rst b/README.rst new file mode 100644 index 0000000..e69de29 diff --git a/wan_qos/__init__.py b/wan_qos/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/wan_qos/agent/__init__.py b/wan_qos/agent/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/wan_qos/agent/ovsdb/__init__.py b/wan_qos/agent/ovsdb/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/wan_qos/agent/ovsdb/impl_idl.py b/wan_qos/agent/ovsdb/impl_idl.py new file mode 100644 index 0000000..6979971 --- /dev/null +++ b/wan_qos/agent/ovsdb/impl_idl.py @@ -0,0 +1,29 @@ +# Copyright (c) 2015 OpenStack Foundation +# +# Licensed under the Apache License, Version 2.0 (the "License"); you may +# not use this file except in compliance with the License. You may obtain +# a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +# License for the specific language governing permissions and limitations +# under the License. + +from neutron.agent.ovsdb import api +from neutron.agent.ovsdb import impl_idl +from neutron.agent.ovsdb.native import commands as cmd +from neutron.agent.ovsdb.native import connection +from neutron.agent.ovsdb.native import idlutils +from neutron.agent.ovsdb.native import vlog + + +class OvsdbQosIdl(impl_idl.OvsdbIdl): + def __init__(self, context, conn, timeout): + super(OvsdbQosIdl, self).__init__(context) + self.ovsdb_connection = connection.Connection(conn, + timeout, + 'Open_vSwitch') + diff --git a/wan_qos/db/__init__.py b/wan_qos/db/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/wan_qos/tests/__init__.py b/wan_qos/tests/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/wan_qos/tests/unit/__init__.py b/wan_qos/tests/unit/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/wan_qos/tests/unit/ovsdb/__init__.py b/wan_qos/tests/unit/ovsdb/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/wan_qos/tests/unit/ovsdb/test_ovsdb.py b/wan_qos/tests/unit/ovsdb/test_ovsdb.py new file mode 100644 index 0000000..7dc237a --- /dev/null +++ b/wan_qos/tests/unit/ovsdb/test_ovsdb.py @@ -0,0 +1,40 @@ +# Copyright (c) 2016 Red Hat, Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); you may +# not use this file except in compliance with the License. You may obtain +# a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +# License for the specific language governing permissions and limitations +# under the License. + +import mock +import testtools + +from neutron.tests import base + +import wan_qos.agent.ovsdb.impl_idl as impl_idl +import wan_qos.agent.ovsdb.commands as cmd + + +class OvsdbIdlTestCase(base.BaseTestCase): + def setUp(self): + super(OvsdbIdlTestCase, self).setUp() + self.vsctl_timeout = 10 + self.ovsdb_idl = impl_idl.OvsdbQosIdl(self, 'tcp:127.0.0.1:6640', 30) + self.ovsdb_idl.ovsdb_connection.start() + self.idl = self.ovsdb_idl.ovsdb_connection.idl + + def test1(self): + assert self.ovsdb_idl.br_exists('tc-br').execute()==True + + def get_queue_list(self): + print (cmd.GetQueueIdList(self.ovsdb_idl, 'enp1s0f1').execute()) + + def add_queue(self): + print (cmd.AddQueue(self.ovsdb_idl, 'enp1s0f1', 1, '1000000', '1000000') + .execute())