ovsdb.git
3 years agoAdd INFO.yaml for ovsdb 59/91259/3
Anil Belur [Sun, 12 Jul 2020 01:36:17 +0000 (11:36 +1000)]
Add INFO.yaml for ovsdb

Signed-off-by: Anil Belur <abelur@linuxfoundation.org>
Change-Id: I89d483ef4c5b9c669fb8a971e438085a79c635d4
Signed-off-by: Chetan Arakere Gowdru <chetan.arakere@altencalsoftlabs.com>
3 years agoChange log level from ERROR to warn. 23/90923/3
Chetan Arakere Gowdru [Mon, 6 Jul 2020 05:13:14 +0000 (10:43 +0530)]
Change log level from ERROR to warn.

Description:
When a connection is termination by Peer, following log is logged at
error level causing to get captured in teardown making TC as failure.

Exception occurred while processing connection pipeline
io.netty.channel.unix.Errors$NativeIoException: readAddress(..) failed: Connection reset by peer

Change the log level from ERROR to warn as this exception is expected
during connection teardown and not making TC to mark as fail for this.

JIRA : OVSDB-496

Signed-off-by: Chetan Arakere Gowdru <chetan.arakere@altencalsoftlabs.com>
Change-Id: I82a585d4478f07e29f8b04600b7df95bb98c6d08
Signed-off-by: Chetan Arakere Gowdru <chetan.arakere@altencalsoftlabs.com>
3 years agoUsing MD-SAL .exists() API 61/89661/9
Chetan Arakere Gowdru [Mon, 11 May 2020 10:05:22 +0000 (15:35 +0530)]
Using MD-SAL .exists() API

Description:
Whenever we are performing read operations just to
check it's presence in DS, instead of doing such read,
we can make use of MD-SAL exist() API which provides better performance.

Enhanced INFO level Logging statements.

Signed-off-by: Chetan Arakere Gowdru <chetan.arakere@altencalsoftlabs.com>
Change-Id: Ie81f1be19e60af5081780bf0d43419ab433b9d4e
Signed-off-by: Chetan Arakere Gowdru <chetan.arakere@altencalsoftlabs.com>
3 years agoEliminate Duplicate Controller MD-SAL code 77/89577/7
Chetan Arakere Gowdru [Mon, 4 May 2020 07:27:33 +0000 (12:57 +0530)]
Eliminate Duplicate Controller MD-SAL code

With the MD-SAL migration done, there are now two almost identical
classes. Remove duplicate classes.

JIRA: OVSDB-495

Signed-off-by: Chetan Arakere Gowdru <chetan.arakere@altencalsoftlabs.com>
Change-Id: Idc6dd7198fb99d5f97f056c84f20659734dd8094
Signed-off-by: Chetan Arakere Gowdru <chetan.arakere@altencalsoftlabs.com>
3 years agoClean up MRI feature references 95/90595/1
Robert Varga [Tue, 23 Jun 2020 06:57:18 +0000 (08:57 +0200)]
Clean up MRI feature references

We should be referring to MRI features through ranges, fix that up.

Change-Id: Idede2bd4ebfa6bc8cb06e966adb68d662d2033d4
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 years agoFix NPE in disconnect path 60/90460/3
Robert Varga [Tue, 16 Jun 2020 16:23:04 +0000 (18:23 +0200)]
Fix NPE in disconnect path

We should not be touching instance identifier if the node does
not exist in connection manager. Fixes the following splat:

java.lang.NullPointerException: null
at org.opendaylight.ovsdb.southbound.OvsdbDataTreeChangeListener.disconnect(OvsdbDataTreeChangeListener.java:151) ~[bundleFile:?]
at org.opendaylight.ovsdb.southbound.OvsdbDataTreeChangeListener.onDataTreeChanged(OvsdbDataTreeChangeListener.java:103) ~[bundleFile:?]
at org.opendaylight.mdsal.binding.dom.adapter.BindingDOMDataTreeChangeListenerAdapter.onDataTreeChanged(BindingDOMDataTreeChangeListenerAdapter.java:37) ~[bundleFile:?]
at org.opendaylight.controller.cluster.datastore.DataTreeChangeListenerActor.dataTreeChanged(DataTreeChangeListenerActor.java:83) [bundleFile:?]
at org.opendaylight.controller.cluster.datastore.DataTreeChangeListenerActor.handleReceive(DataTreeChangeListenerActor.java:44) [bundleFile:?]

Change-Id: Ibabc7f5324742fce04bc6f02b54a1ead945b15cb
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 years agoAvoid excessive ovsdb log statements 70/87370/2
Chetan Arakere Gowdru [Mon, 3 Feb 2020 08:31:11 +0000 (14:01 +0530)]
Avoid excessive ovsdb log statements

Signed-off-by: Chetan Arakere Gowdru <chetan.arakere@altencalsoftlabs.com>
Change-Id: Ifd12522cc4891fb01cde5cb2de5b5333e690f841

3 years agoIntegrate controller-2.0.2 09/90409/1
Robert Varga [Thu, 11 Jun 2020 21:45:28 +0000 (23:45 +0200)]
Integrate controller-2.0.2

This bumps versions to the following:
- odlparent-7.0.3
- yangtools-5.0.3
- mdsal-6.0.2
- controller-2.0.2

Change-Id: Ic9021658c58aaa3d0d40a858a6272f5e5b1fcbe1
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 years agoIntegrate controller-2.0.1 59/90159/1
Robert Varga [Sun, 31 May 2020 09:29:07 +0000 (11:29 +0200)]
Integrate controller-2.0.1

This bumps versions to the following:
- odlparent-7.0.2
- yangtools-5.0.2
- mdsal-6.0.1
- controller-2.0.1

Change-Id: I60bd9f78cde3f35e3b3c1d8a399e73c847b82f14
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 years agoSet version to Aluminium 35/88735/2
Thanh Ha [Thu, 26 Mar 2020 19:54:56 +0000 (15:54 -0400)]
Set version to Aluminium

Signed-off-by: Thanh Ha <zxiiro@gmail.com>
Change-Id: Iab07ad88b9a8bb114d50d28f263d71749be06e17

4 years agoUpdate MRI projects for Aluminium 41/89541/2
Robert Varga [Fri, 1 May 2020 07:37:10 +0000 (09:37 +0200)]
Update MRI projects for Aluminium

This bumps versions to the following:
- odlparent-7.0.1
- yangtools-5.0.1
- mdsal-6.0.0
- controller-2.0.0

These updates imply that an unkeyed list cannot be deleted by
setting it to empty its parent node and issuing a merge() of that
parent node. This is used only in two places -- hence we update
them.

We also get access to proper Map view of keyed lists, which makes
a number of operations faster, as we can just defer to a lookup
instead of iterating of the entire list.

Finally features and build system is updated to not leak
javax.annotation and upstream bundles into runtime.

Change-Id: I78207959d9f62d79af83f57c859f5fbd393077aa
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoMD-SAL API integration 02/87802/21
xcheara [Fri, 14 Feb 2020 13:07:01 +0000 (18:37 +0530)]
MD-SAL API integration

Migrate all code to use MD-SAL APIs from the mdsal project, not controller.
Also remove dependencies on org.opendaylight.controller where not appropriate.

JIRA: OVSDB-487

Change-Id: I5ed9e800420887bc6b453f23eb77bcd54d9c27a9
Signed-off-by: Chetan Arakere Gowdru <chetan.arakere@altencalsoftlabs.com>
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Signed-off-by: Chetan Arakere Gowdru <chetan.arakere@altencalsoftlabs.com>
4 years agoEnhance the McastMacsRemoteUpdateCommand to get the uuid from the device if not prese... 42/89042/5
Chandra Shekar S [Mon, 13 Apr 2020 10:57:47 +0000 (16:27 +0530)]
Enhance the McastMacsRemoteUpdateCommand to get the uuid from the device if not present in cache

This review is to :
1. Enhance the McastMacsRemoteUpdateCommand to get the uuid from the device if not present in cache
2. Minor refactors on the MacsCommands

Signed-off-by: Chandra Shekar S <chandra.shekar.s@ericsson.com>
Change-Id: I73f6114cacfd86c59301f098f4338125c32dc65d

4 years agomake sure ovsdb connected node appears in operds 58/88958/4
Chetan Arakere Gowdru [Wed, 8 Apr 2020 05:37:56 +0000 (11:07 +0530)]
make sure ovsdb connected node appears in operds

if the conected node does not appear in oper ds
disconnect the node, upon reconnection it may succeed in getting into
operds.

Signed-off-by: Chetan Arakere Gowdru <chetan.arakere@altencalsoftlabs.com>
Change-Id: I1091e0a1a644141467e6d4bda5a058af60110a62
Signed-off-by: Chetan Arakere Gowdru <chetan.arakere@altencalsoftlabs.com>
4 years agoFix delete of Logical_Switch for the "referential integrity violation" failure. 68/88968/4
Chandra Shekar S [Wed, 8 Apr 2020 08:50:31 +0000 (14:20 +0530)]
Fix delete of Logical_Switch for the "referential integrity violation" failure.

Currently the Logical_Switch delete is failing with "referential integrity violation" error as listed below
2020-04-13T05:27:36,854 | ERROR | hwvtep-waiting-job-0 | TransactInvokerImpl              | 403 - org.opendaylight.ovsdb.hwvtepsouthbound-impl - 1.11.0.SNAPSHOT | HWVTEP transaction operation failed referential integrity violation cannot delete Logical_Switch row 7392ce5a-1bf6-4951-a22e-740ac78aaa60 because of 9 remaining reference(s)
2020-04-13T05:27:36,855 | ERROR | hwvtep-waiting-job-0 | TransactInvokerImpl              | 403 - org.opendaylight.ovsdb.hwvtepsouthbound-impl - 1.11.0.SNAPSHOT | Failed transaction delete from Logical_Switchdelete from Ucast_Macs_Remotedelete from Ucast_Macs_Localdelete from Mcast_Macs_Remotedelete from Mcast_Macs_Local
2020-04-13T05:27:36,856 | ERROR | hwvtep-waiting-job-0 | TransactInvokerImpl              | 403 - org.opendaylight.ovsdb.hwvtepsouthbound-impl - 1.11.0.SNAPSHOT | Failed on second attempt too aborting the transaction org.opendaylight.ovsdb.hwvtepsouthbound.transact.LogicalSwitchRemoveCommand$1@575aaf7c
2020-04-13T05:27:36,857 | ERROR | hwvtep-waiting-job-0 | TransactInvokerImpl              | 403 - org.opendaylight.ovsdb.hwvtepsouthbound-impl - 1.11.0.SNAPSHOT | HWVTEP transaction operation failed referential integrity violation cannot delete Logical_Switch row 064cc69b-cce8-4f08-9478-9b82c6059cac because of 9 remaining reference(s)
2020-04-13T05:27:36,858 | ERROR | hwvtep-waiting-job-0 | TransactInvokerImpl              | 403 - org.opendaylight.ovsdb.hwvtepsouthbound-impl - 1.11.0.SNAPSHOT | Failed transaction delete from Logical_Switchdelete from Ucast_Macs_Remotedelete from Ucast_Macs_Localdelete from Mcast_Macs_Remotedelete from Mcast_Macs_Local
2020-04-13T05:27:36,858 | ERROR | hwvtep-waiting-job-0 | TransactInvokerImpl              | 403 - org.opendaylight.ovsdb.hwvtepsouthbound-impl - 1.11.0.SNAPSHOT | Failed on second attempt too aborting the transaction org.opendaylight.ovsdb.hwvtepsouthbound.transact.LogicalSwitchRemoveCommand$1@569e133b

The Logical_Switch reference will be present in other tables like Ucast_Macs_Remote, Pysical_Port and Ucast_Macs_Remote etc.
These should be deleted first when the Logical_Switch is going to be deleted.

Signed-off-by: Chandra Shekar S <chandra.shekar.s@ericsson.com>
Change-Id: Ic2b101368bd50f6494e357fa49ccf53e641a09a3

4 years agoNPE Exception while processing Interfaces 49/88449/8
Chetan Arakere Gowdru [Tue, 17 Mar 2020 02:38:50 +0000 (08:08 +0530)]
NPE Exception while processing Interfaces

Description: Its been observed that if the port is created first
followed by setting the external-ids, the termination points are
not updated properly with is external-ids.

Changes are done to cache the bridge Identifier and refer this cache
during interface-update is obtained for the port.

Signed-off-by: Chetan Arakere Gowdru <chetan.arakere@altencalsoftlabs.com>
Change-Id: I8e55733bccfa8dae013dda985678514e1ceb98d5
Signed-off-by: Chetan Arakere Gowdru <chetan.arakere@altencalsoftlabs.com>
4 years agoEnhance the use of cache in HwvtepDeviceInfo 27/88927/3
Chandra Shekar S [Tue, 7 Apr 2020 07:44:40 +0000 (13:14 +0530)]
Enhance the use of cache in HwvtepDeviceInfo

This review is to enhace the HwvtepDeviceInfo to use the Cache.
It has the following changes.
1. Enhanced to include the incoming update objects in the cache.
2. Check in the cache before deleting.
3. Update the cache when the updates are successfully submitted to db.

Signed-off-by: Chandra Shekar S <chandra.shekar.s@ericsson.com>
Change-Id: I70a923f2b58077e780b53c457b05bb2545a87d4f

4 years agoHwvtep minor refactor to getPhysicalLocator 01/88801/2
Chandra Shekar S [Mon, 30 Mar 2020 08:50:32 +0000 (14:20 +0530)]
Hwvtep minor refactor to getPhysicalLocator

Signed-off-by: Chandra Shekar S <chandra.shekar.s@ericsson.com>
Change-Id: I41147c1e6549c430572390cf0eee5d2a975de63c

4 years agoRetry mechanism for Hwvtep failed Transaction commands 41/88741/2
Chandra Shekar S [Fri, 27 Mar 2020 04:43:49 +0000 (10:13 +0530)]
Retry mechanism for Hwvtep failed Transaction commands

Signed-off-by: Chandra Shekar S <chandra.shekar.s@ericsson.com>
Change-Id: Ic15829836a316e1f21a0481089ae119cb38e60d1

4 years agoAvoid push the stale vlan to tor. 67/88767/3
Chandra Shekar S [Sun, 29 Mar 2020 07:31:16 +0000 (13:01 +0530)]
Avoid push the stale vlan to tor.

If the ls is not present on the tor, don't push the vlan for that ls

Signed-off-by: Chandra Shekar S <chandra.shekar.s@ericsson.com>
Change-Id: I2362f33eacac3a8cf39fe8d9f1668ce7477f31ad

4 years agoUse Magnesium controller 79/88679/4
Robert Varga [Wed, 25 Mar 2020 21:48:04 +0000 (22:48 +0100)]
Use Magnesium controller

As part of controller transition to being MRI, downgrade the version
used to Magnesium release. This will be bumped to Aluminium proper
during the MRI window.

Change-Id: I592a291a25924621e85a83c66b168ec9dfbdd307
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoProcessing Hwvtep/Ovsdb client only once 86/88586/3
Chandra Shekar S [Mon, 23 Mar 2020 10:11:17 +0000 (15:41 +0530)]
Processing Hwvtep/Ovsdb client only once

There are chances of same client is getting processed multiple times
and resulting in stale eos entry in one controller.

Due to this stale eos entry in controller1 if the device is getting
connected to controller2 it could not be processed as controller1 still
remains as eos leader for this device.

Ideally controller1 should have released its ownership when the device is
disconnected.

Signed-off-by: Chandra Shekar S <chandra.shekar.s@ericsson.com>
Change-Id: I3b8705d7c18358a1f5be78e5ec3b50055464c23f

4 years agoFix serviceutils dependency 46/88746/3
Robert Varga [Fri, 27 Mar 2020 08:47:45 +0000 (09:47 +0100)]
Fix serviceutils dependency

Use serviceutils-artifacts to get the right set of artifacts,
and bump it to 0.6.0-SNAPSHOT, as that is what Aluminium is using.

While we are at it, also centralize infrautils definitions.

Change-Id: I38c1ad81bffc23b521c2c07f36e0d76f0f6665a0
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoUpgrade support for hwvtep reconciliation 33/88533/2
Chandra Shekar S [Wed, 18 Mar 2020 10:00:54 +0000 (15:30 +0530)]
Upgrade support for hwvtep reconciliation

Signed-off-by: Chandra Shekar S <chandra.shekar.s@ericsson.com>
Change-Id: I5ed959004ced1c4a4b22aea67ab11d3aab291daf

4 years agoHandle EOS Timeout for the Hwvtep Node addition. 54/88454/3
Chandra Shekar S [Tue, 17 Mar 2020 09:40:18 +0000 (15:10 +0530)]
Handle EOS Timeout for the Hwvtep Node addition.

If the Hwvtep Node is not added after the connection because of any error/exceptions ( ex: EOS) ,
add a job to disconnect hwvtep to the schedular so that the next iteration it could successed.

Signed-off-by: Chandra Shekar S <chandra.shekar.s@ericsson.com>
Change-Id: Ib805f1689f5f696c0df876f833a855da1e537e45

4 years agoBump versions by x.y.(z+1) 97/87997/1
jenkins-releng [Sat, 22 Feb 2020 04:30:16 +0000 (04:30 +0000)]
Bump versions by x.y.(z+1)

Signed-off-by: jenkins-releng <jenkins-releng@opendaylight.org>
Change-Id: I0ea20651c89d6db173f1e0872d4219e9e2895b6c

4 years agoSynchronize the HwvtepNode Delete and Add for connection flaps 55/86955/8
Chandra Shekar S [Thu, 16 Jan 2020 09:21:53 +0000 (14:51 +0530)]
Synchronize the HwvtepNode Delete and Add for connection flaps

Signed-off-by: Chandra Shekar S <chandra.shekar.s@ericsson.com>
Change-Id: I55cbd9324995d61cf9f8f83445f294bbe6f34b0b

4 years agoBump to odlparent-6.0.4/yangtools-4.0.6/mdsal-5.0.9 00/87000/2
Robert Varga [Thu, 16 Jan 2020 21:11:53 +0000 (22:11 +0100)]
Bump to odlparent-6.0.4/yangtools-4.0.6/mdsal-5.0.9

Pick up latest fixes and upgrades.

Change-Id: I30f1f4495e91a0b9c0f8a40ca107f48b154ceba1
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoFix Hwvtep Port reconciliation to handle Physical_Port Delete and Add from switch 59/86859/2
Chandra Shekar S [Mon, 13 Jan 2020 07:19:43 +0000 (12:49 +0530)]
Fix Hwvtep Port reconciliation to handle Physical_Port Delete and Add from switch

JIRA: OVSDB-494

If the Hwvtep Physical_Port is deleted and added back, vlan bindings are not getting
pushed the switch in this case.
When the Hwvtep Physical_Port is deleted and added back, the uuid of the Port
will get changed, ODL is not handling this case properly as a result of it
vlan bindings are pushed to the switch.
This review is to fix this functionality and get the terminationpoint from the
cache instead of from db, in the reconcilePort.

Signed-off-by: Chandra Shekar S <chandra.shekar.s@ericsson.com>
Change-Id: I8a35c88a0945c320c1f89307223873067d0a6ff2

4 years agoEnhance Hwvtep Device TransactionHistory. 35/86835/2
Chandra Shekar S [Fri, 10 Jan 2020 05:28:27 +0000 (10:58 +0530)]
Enhance Hwvtep Device TransactionHistory.

JIRA: OVSDB-482

Currently the Hwvtep TransactionHistory is not collected for some of the important
hwvtep tables/objects like Global,PhysicalSwitch, Manager etc.
Collecting these information in the TransactionHistory will help in analyzing/debugging
the issue by looking at the karaf cli command instead of logging and looking at the switch.

Sample output
opendaylight-user@root>hwvtep:txlog -nodeid hwvtep://uuid/f800aea8-f7c7-4f61-ae71-fe8b5813bd25
Printing for Node :  hwvtep://uuid/f800aea8-f7c7-4f61-ae71-fe8b5813bd25
Fri Jan 10 06:12:08 UTC 2020 DEVICE ADD ClientConnected [port=58030]
Fri Jan 10 06:12:08 UTC 2020 DEVICE ADD Global : Row [columns={other_config=[other_config={}], switches=[switches=[ca786e4b-3355-423d-8bd2-c7645193e8d7]], _uuid=[_uuid=f800aea8-f7c7-4f61-ae71-fe8b5813bd25], managers=[managers=[7f75566c-6181-4059-b33f-dfd326bf3499]]}]
Fri Jan 10 06:12:08 UTC 2020 DEVICE ADD Physical_Switch : Row [columns={tunnels=[tunnels=[]], tunnel_ips=[tunnel_ips=[172.18.0.7]], other_config=[other_config={}], management_ips=[management_ips=[]], name=[name=s3], description=[description=OVS VTEP Emulator], _uuid=[_uuid=ca786e4b-3355-423d-8bd2-c7645193e8d7], ports=[ports=[d6b07d34-c924-430c-aaa2-c3679287adebe600b737-22ea-489a-9232-0d64ee787b43d724ca83-c192-46fa-8d71-fbcfbfffd5791d3a727f-4d37-466f-9e2c-06ffa006636c2ce0fec1-9231-4b31-ba6c-bec80ab8ca8f0939560b-02f1-4ce0-9ef5-db1cd8de4c9009a9235b-021f-4988-8c94-5173de4e56d7f8625113-f3ab-40fe-99eb-83709456e80d083feeec-a272-4d7f-a55d-04b126d9de43]], switch_fault_status=[switch_fault_status=[]]}]
Fri Jan 10 06:12:08 UTC 2020 DEVICE ADD Manager : Row [columns={is_connected=[is_connected=false], other_config=[other_config={ha_id=s3, ha_enabled=true}], max_backoff=[max_backoff=[]], _uuid=[_uuid=7f75566c-6181-4059-b33f-dfd326bf3499], inactivity_probe=[inactivity_probe=[]], target=[target=tcp:172.18.0.3:6640]}]

Signed-off-by: Chandra Shekar S <chandra.shekar.s@ericsson.com>
Change-Id: Ifeaa84087cb625004d6c27daeec8b04b04eb9ed0

4 years agoFix NPE in SouthboundUtils 23/86823/2
Chandra Shekar S [Thu, 9 Jan 2020 10:30:23 +0000 (16:00 +0530)]
Fix NPE in SouthboundUtils

JIRA: OVSDB-492

Add the null check to avoid the SouthboundUtils.compareDbVersionToMinVersion()
throwing the NPE.
By any chance if the method is getting triggered with one of the parameter as null,
throws the NPE.

Signed-off-by: Chandra Shekar S <chandra.shekar.s@ericsson.com>
Change-Id: Ibd29fe283fec7376baec56c0fbbb35529e157dbb

4 years agoOptimize the OvsdbPortUpdateCommand during the ODL reboot/Ovsdb connection 19/86819/3
Chandra Shekar S [Thu, 9 Jan 2020 06:41:18 +0000 (12:11 +0530)]
Optimize the OvsdbPortUpdateCommand during the ODL reboot/Ovsdb connection

JIRA: OVSDB-491

When the Compute is connected or flapped, ODL will retrieve all the Ovsdb
configuration from the Compute with MonitorCallBack and process the these configurations
and updates them into the topology operational datastore.
Currently OvsdbPortUpdateCommand will extract the port information that retrieved from
compute and update the same to topology operational datastore. Each port update is resulting in
one database operations.
In scale setup the number ports will be in big number and will result in huge number of
database operations to update these port informations.
It will give us the perfomance improvement if the number of database operations for the
port updates is done per bridge instead of per port, during Ovsdb connection.
This will reduce the number of db operations to number bridges instead of number of port

This review is collect all the Port create commands and update the datastore with
single merge on bridge node.

Signed-off-by: Chandra Shekar S <chandra.shekar.s@ericsson.com>
Change-Id: Ie3ab258fb665d40e92177b4435b1bd72c07fdb81

4 years agoUse seperate txn when quering multiple shards 20/86820/5
Chetan Arakere Gowdru [Thu, 9 Jan 2020 09:05:20 +0000 (14:35 +0530)]
Use seperate txn when quering multiple shards

Description:
The txn which been used for updating oper topo been also used to query
config topo. Changes done to use a new transaction while querying
different shards.

Signed-off-by: Chetan Arakere Gowdru <chetan.arakere@altencalsoftlabs.com>
Change-Id: I90befb242c47df2bcbdcb09b92708c20a97e78c0
Signed-off-by: Chetan Arakere Gowdru <chetan.arakere@altencalsoftlabs.com>
Signed-off-by: xcheara <chetan.arakere@altencalsoftlabs.com>
4 years agoAvoid unnecessary bridge Oper DS read 18/86818/5
Chetan Arakere Gowdru [Thu, 9 Jan 2020 07:03:00 +0000 (12:33 +0530)]
Avoid unnecessary bridge Oper DS read

Description:
Avoid uncessary bridge Oper DS read just to get the bridge-name during
termination-point create and delete. The bridge name is already
available in the termination point parent node-id(/bridge/br-int) from
which bridge name can get fetched out.

Ex: "node-id": "ovsdb://uuid/d6f5d855-cdae-4275-bf4f-a71ee6e24ca3/bridge/br-int"

Signed-off-by: Chetan Arakere Gowdru <chetan.arakere@altencalsoftlabs.com>
Change-Id: I420face0c628f118b14c5c213756075a199ea6fa
Signed-off-by: Chetan Arakere Gowdru <chetan.arakere@altencalsoftlabs.com>
Signed-off-by: xcheara <chetan.arakere@altencalsoftlabs.com>
4 years agoCheck for the SHARD Status before opening the OVSDB port/HwvtepSouthboundProvider... 29/83229/5
Chandra Shekar S [Wed, 24 Jul 2019 09:49:01 +0000 (15:19 +0530)]
Check for the SHARD Status before opening the OVSDB port/HwvtepSouthboundProvider intialization.

JIRA: OVSDB-484

Currently the HwvtepSouthboundProvider is intialized and the Ovsdb port is opened.
As soon as the Ovsdb port is opened the tors will connected to the HwvtepSouthboundPlugin.
The HwvtepSouthboundPlugin will process the connected tors and tries to build the topology operational
and further the topology config and tries to update these datastores.
If the topology SHARDs are not up or the SHARD leaders are not elected by this time, it ends up in the
exceptions while updating the datastores and the operational and config datastores will not be populated
with the expected data.

The fix is check for the topology config and operational SHARDs status up and Leaders for these are
elected and then initialize HwvtepSouthboundProvider and start Ovsdb port when they are up.

Signed-off-by: Chandra Shekar S <chandra.shekar.s@ericsson.com>
Change-Id: Ia8599b9ed9cc3d5afbdb29a951cebee01c15ddbe

4 years agoLookup up bridge in old bridges when the port is removed 88/86188/9
Robert Varga [Wed, 4 Dec 2019 14:50:14 +0000 (15:50 +0100)]
Lookup up bridge in old bridges when the port is removed

Updated bridges may be empty, in which case we do want to fall
back to the old bridge data to pick up the old bridge data --
otherwise we would end up looking up the wrong thing.

JIRA: OVSDB-413
Change-Id: I289314481595a38911f06c0ba1fe659896cb53e8
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoOptimization to read the OvsdbNode from the cache. 77/85177/7
Chandra Shekar S [Wed, 16 Oct 2019 13:55:32 +0000 (19:25 +0530)]
Optimization to read the OvsdbNode from the cache.

JIRA: OVSDB-488

Currently in the OvsdbSouthboudn plugin reads the OvsdbNode from the datastore.
Reading the OvsdbNode from the datastore ineffecient.

This review is avoid the OvsdbNode reads from the datastore and get it from the cache.
If the node is not present in the cache, then read from datastore.

Signed-off-by: Chandra Shekar S <chandra.shekar.s@ericsson.com>
Change-Id: I1e26fa83d0edea45b39c44267488335eea75eb37

4 years agoConstrain TypedDatabaseSchema proxy argument 99/86199/19
Robert Varga [Wed, 4 Dec 2019 20:36:58 +0000 (21:36 +0100)]
Constrain TypedDatabaseSchema proxy argument

We do not operate on any old interface, arguments need to extend
TypedBaseType -- capture that in the API contract.

Change-Id: I978332ef5e0485763b8e04461aaaf12a00891466
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoMake sure TransactionInvokerImpl chain is properly protected 80/86280/15
Robert Varga [Fri, 6 Dec 2019 21:08:28 +0000 (22:08 +0100)]
Make sure TransactionInvokerImpl chain is properly protected

TransactionChains require single-threaded access, most notably
their close() contract requires that there be no outstanding
transactions.

There is a slight possibility of us violating this contract by
invoking close() while there is some command processing going
on.

Make sure we are properly synchronized when invoking the close()
call.

Change-Id: Idacc7096af448dc3a935ca3aa7ea2452bbd0135e
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoIsolate TransactionInvokerImpl.executeCommand() 79/86279/14
Robert Varga [Fri, 6 Dec 2019 20:35:31 +0000 (21:35 +0100)]
Isolate TransactionInvokerImpl.executeCommand()

This is a chunk of logic which is independent of its surroundings,
but requires proper locking.

JIRA: OVSDB-428
Change-Id: I7db00574a50955e3bf3531cea23ba85b80e11bdb
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoEliminate TransactionInvokerImpl.transactionToCommand 78/86278/11
Robert Varga [Fri, 6 Dec 2019 20:58:39 +0000 (21:58 +0100)]
Eliminate TransactionInvokerImpl.transactionToCommand

This map holds Transaction->Command mapping, but it is always
accessed from a context which directly operates on
pendingTransactions queue.

Eliminate the need for lookups (and general HashMap overhead)
by making pendingTransactions hold a pair of transaction/command.

JIRA: OVSDB-428
Change-Id: Ic3040f770a2b3391e188b3ffa7a693776d0058b7
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoUse ArrayDeque for TransactionInvokerImpl.pendingTransactions 45/86245/26
Robert Varga [Thu, 5 Dec 2019 21:41:22 +0000 (22:41 +0100)]
Use ArrayDeque for TransactionInvokerImpl.pendingTransactions

Rework the copy logic to operate on pure Iterator, disconnecting us
from the List API. This makes the choice of interface/implementation
a much broader one -- and pick Queue/ArrayDeque. It is a much better
structure for the job at hand.

JIRA: OVSDB-428
Change-Id: I22a4da6f4194d10e0932470bf2054441a9c1d3c1
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoFix transaction replay logic 69/86269/15
Robert Varga [Fri, 6 Dec 2019 13:53:44 +0000 (14:53 +0100)]
Fix transaction replay logic

After adding disambiguation (previous patch), it clear there is
a day-0 Obi-Wan bug in the code, which would cause the last
command to not be replayed.

Looking at the pending queue, if the transaction failing is second,
the second and third transactions should be replayed, not just
the second.

JIRA: OVSDB-428
Change-Id: Ifbdf5ba8bad5be6103e4666d95afd615ae7d1ab9
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoDisambiguate TransactionInvokerImplTest assertion 77/86277/8
Robert Varga [Fri, 6 Dec 2019 19:56:47 +0000 (20:56 +0100)]
Disambiguate TransactionInvokerImplTest assertion

Do not reuse mock objects for transactions, as that means we are
asserting that one them is replayed, except that we want to be
asserting that the last transaction was replayed.

JIRA: OVSDB-428
Change-Id: If7bf37edb46cd2ce155325e257cf1a891f8b2bf5
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoCleanup TransactionInvokerImplTest 68/86268/10
Robert Varga [Fri, 6 Dec 2019 13:28:14 +0000 (14:28 +0100)]
Cleanup TransactionInvokerImplTest

This unit test is overly whiteboxish, to the point it mocks internal
TransactionInvokerImpl structures. Refactor the test, exposing proper
@VisibleForTesting methods so that we do not end up modifying/mocking
structure access, but rather observe state transitions.

JIRA: OVSDB-428
Change-Id: I26b5c258b385ff1cfad34ff7d19a9589979ec4d7
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoEliminate TransactionInvokerImpl.successfulTransactionQueue 44/86244/16
Robert Varga [Thu, 5 Dec 2019 21:12:31 +0000 (22:12 +0100)]
Eliminate TransactionInvokerImpl.successfulTransactionQueue

This queue is actually just a hand-off between the datastore callback
thread and the central thread. There is no need for such a queue, as
we can just properly synchronize access to the critical structures.

JIRA: OVSDB-428
Change-Id: Idba05aebfa7fd35dbdb706b8bfef03e3e03d7772
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoUse properties to control install/deploy plugins 39/86739/1
Robert Varga [Mon, 6 Jan 2020 11:55:09 +0000 (12:55 +0100)]
Use properties to control install/deploy plugins

Rather than using full plugin configuration, just drop in properties
to control them.

Change-Id: If17d7d419e0f69d770e1cb8b39ca34ea09e036ea
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoUpgrade support of ovsdb reconciliation 72/82772/7
Chetan Arakere Gowdru [Fri, 28 Jun 2019 11:08:08 +0000 (16:38 +0530)]
Upgrade support of ovsdb reconciliation

Description:
When Upgrade in process, the config DS may not be fully populated when
reconciliaiton is triggered. This will result in uncessaary deletion on tunnels
(as config and oper DS are compared and delta changes will be pushed to switch).
Changes are done to postpone the reconcilaiton task until upgrade flag is set to false.

Testing Steps.

1) Karaf up and running and tunnels created.
2) Set upgade flag to true.
PUT http://localhost:8181/restconf/config/odl-serviceutils-upgrade:upgrade-config
{
  "upgrade-config": {
    "upgradeInProgress": true
  }
}
3) Close karaf terminal(kill karaf process)
4) Don’t clear data/instance/journal/snapshots
5) del-manager on switches and delete tunnels manually on switches.
6) Start karaf and wait DPN connects.
7) Check the tunnel are not recreated by reconciliation process.
8) Set upgradeInProgress=false and check the tunnels re-created back

Change-Id: Id6cc8e1a3aa5e139597fa3071d536e1f5ac0802f
Signed-off-by: Chetan Arakere Gowdru <chetan.arakere@altencalsoftlabs.com>
Signed-off-by: xcheara <chetan.arakere@altencalsoftlabs.com>
4 years agoNaming Anonymous Threads in OVSDB 52/85752/6
xcheara [Fri, 1 Nov 2019 23:14:55 +0000 (04:44 +0530)]
Naming Anonymous Threads in OVSDB

JIRA : OVSDB-454

Description:
There are few Anonymous Threads created in OVSDB. It will be difficult to
identify which component created these threads based on the logs
available.

Changes done to provide proper Name to these Threads when created which
helps to easily identify the component owner of such threads.

Signed-off-by: xcheara <chetan.arakere@altencalsoftlabs.com>
Change-Id: I061abd449f81c7cc2c7c847cb1a0f82d62d7e654
Signed-off-by: xcheara <chetan.arakere@altencalsoftlabs.com>
4 years agoRemove powermock overrides 46/86446/1
Robert Varga [Mon, 16 Dec 2019 23:43:52 +0000 (00:43 +0100)]
Remove powermock overrides

powermock should now be working out of the box, allowing us to
minimize dependencies.

Change-Id: I1d9d7541f46b68cfd026a768feedfdf2f0865c9d
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoRemove ARIES-1923 workaround 41/86441/1
Robert Varga [Mon, 16 Dec 2019 21:07:49 +0000 (22:07 +0100)]
Remove ARIES-1923 workaround

We now have proper monkey-patch in place and can therefore remove
this workaround.

Change-Id: Ia66faa79b1b0592bc0b45b066ea57f7a7a3c3269
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoBump odlparent/yangtools/mdsal to 6.0.3/4.0.3/5.0.6 72/86372/3
Robert Varga [Thu, 12 Dec 2019 07:04:22 +0000 (08:04 +0100)]
Bump odlparent/yangtools/mdsal to 6.0.3/4.0.3/5.0.6

Pick up the latest upgrades and fixes.

Change-Id: I2f3f76c8746fa2b01c5d1f639ef1b6c419435cf6
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoImprove ConnectionReconciliationTask type safety 38/86238/3
Robert Varga [Thu, 5 Dec 2019 13:29:33 +0000 (14:29 +0100)]
Improve ConnectionReconciliationTask type safety

We require InstanceIdentifier<Node> and OvsdbNodeAugmentation
config data, make sure to reflect that in the API.

JIRA: OVSDB-413
Change-Id: I8d6a86cf455e3ff05f0851def22d6520adabf5d2
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoImprove BridgeConfigReconciliationTask type safety 37/86237/2
Robert Varga [Thu, 5 Dec 2019 13:22:04 +0000 (14:22 +0100)]
Improve BridgeConfigReconciliationTask type safety

We really want InstanceIdentifier<Node>, make sure we require that
in the constructor.

Change-Id: Ide8e17e46afe983389b7617afda9982257d283db
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoCleanup ReconciliationTask 36/86236/2
Robert Varga [Thu, 5 Dec 2019 13:20:52 +0000 (14:20 +0100)]
Cleanup ReconciliationTask

This is a simple upkeep, converting primarily converting to use
Objects.requireNonNull().

JIRA: OVSDB-413
Change-Id: I0ccf60e14899f90a7f8eead9bf8f75ae94d30857
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoAdd support for Controller.type 03/86203/4
Robert Varga [Thu, 5 Dec 2019 11:25:30 +0000 (12:25 +0100)]
Add support for Controller.type

This mirrors the schema update done in
https://github.com/openvswitch/ovs/commit/c66be90bd9a04bc98e8ef32f684a3d7283379f66#diff-01f05b225090c4067284ed798ed23f05
and shipping with OVS 2.12.0.

Change-Id: I3658c182293e8bfe40a16d6e4178199f10836424
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoAdd support for OpenVSwitch.dpdk_{initialized,version} 02/86202/3
Robert Varga [Thu, 5 Dec 2019 11:19:23 +0000 (12:19 +0100)]
Add support for OpenVSwitch.dpdk_{initialized,version}

This mirrors the schema update done in
https://github.com/openvswitch/ovs/commit/3e52fa5644cde2eba56c48355d5664e992992bf2#diff-01f05b225090c4067284ed798ed23f05
and shipping with OVS 2.10.0.

Change-Id: Id584401401bb7f81dc8af5a11eb79ffae7c2932d
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoAdd support for Port.cvlans 01/86201/4
Robert Varga [Thu, 5 Dec 2019 10:17:42 +0000 (11:17 +0100)]
Add support for Port.cvlans

This mirrors the schema update done in
https://github.com/openvswitch/ovs/commit/fed8962aff57f552163ef718cc1b0db582f2295e#diff-01f05b225090c4067284ed798ed23f05
and shipping with OVS 2.8.0.

Change-Id: I98bdbd35261ba76fb6d73e20efe003ef8a6c90ae
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoAdd support for Port.protected 98/86198/5
Robert Varga [Thu, 5 Dec 2019 10:08:24 +0000 (11:08 +0100)]
Add support for Port.protected

This mirrors the database update done in
https://github.com/openvswitch/ovs/commit/ced947ae5d1b9678930b11233b9716ddcb84666a#diff-01f05b225090c4067284ed798ed23f05
and shipping in OVS 2.7.0.

Change-Id: Id4345501ff8d627aa86f08336e82d2500fedd0ce
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoAdd support for Interface.mtu_request 97/86197/5
Robert Varga [Thu, 5 Dec 2019 10:06:21 +0000 (11:06 +0100)]
Add support for Interface.mtu_request

This mirrors the schema update done in
https://github.com/openvswitch/ovs/commit/56abcf497b5615d2c30f62bec5af81a38145ecbc#diff-01f05b225090c4067284ed798ed23f05
and shipping in OVS 2.7.8.

Change-Id: I6f942f5356e6f049f77aba52e8000b9472329b48
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoAdd support for Mirror.snaplen 96/86196/5
Robert Varga [Thu, 5 Dec 2019 10:02:26 +0000 (11:02 +0100)]
Add support for Mirror.snaplen

This mirrors the database update made here:
https://github.com/openvswitch/ovs/commit/1356dbd12125200c319a7d420660e72293baa8ec#diff-01f05b225090c4067284ed798ed23f05
and shipping in OVS 2.6.0.

Change-Id: I598f79c949ac977dca680d47e1d5b1a44270a131
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoSpeed up inputQueue interaction 43/86243/5
Robert Varga [Thu, 5 Dec 2019 20:52:08 +0000 (21:52 +0100)]
Speed up inputQueue interaction

The while() loop here is an open-coded Queue.drainTo(). Read the API
and lead a happy life (knowing the thread contention is much lower
now).

This should help with our ability to drain the input queue more
quickly as we will have less cacheline thrashing.

JIRA: OVSDB-428
Change-Id: I53f3b24fb354dd0b727de26cc55890a70994ae8f
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoMake ChannelInitializers inner classes 71/86171/7
Robert Varga [Tue, 3 Dec 2019 21:37:12 +0000 (22:37 +0100)]
Make ChannelInitializers inner classes

Rather than using an anonymous class to initialize functionity,
define two specializations, making this much more cleaner.

Change-Id: Ia8c9af727e80619cc06102856a4fedebeafcdc54
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoGet rid of useless (Hwvtep)SouthboundProvider thread 66/86166/9
Robert Varga [Tue, 3 Dec 2019 20:36:44 +0000 (21:36 +0100)]
Get rid of useless (Hwvtep)SouthboundProvider thread

The thread instantiated here is useless and the comment is misleading:
ListenerRegistration.close() is specified to be safe in any context
and idempotent. Just get rid of the thread and close the registration
immediately.

This flushes out an immediate problem, where the test would deadlock
due to base test using directExecutor() for DTCLs -- i.e. simulating
execution which does not happen in production. To deal with that we
switch the test to use asynchronous DTCLs and add a simple synchronization
loop to wait for DTCL to trigger.

JIRA: OVSDB-454
Change-Id: I2e86acb9eb30529fcd5d5675005d6c81bd804ba5
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoMigrate OvsdbDataTreeChangeListenerTest 79/86179/3
Robert Varga [Wed, 4 Dec 2019 10:13:30 +0000 (11:13 +0100)]
Migrate OvsdbDataTreeChangeListenerTest

This migrates to use non-deprecated AbstractConcurrentDataBrokerTest,
which allows proper background processing of DTCLs.

JIRA: OVSDB-454
Change-Id: Ic98369564e3d45fdc38e6bbc992b548fe97ba360
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoEliminate server startup threads 65/86165/5
Robert Varga [Tue, 3 Dec 2019 20:27:35 +0000 (21:27 +0100)]
Eliminate server startup threads

These were necessary to clean up the server loop groups, but that
is no longer necessary as they have separate lifecycle. Now the
threads serve only the purpose for asynchronous start, which is
easily done with ChannelFutureLister.

Change-Id: I4eaff47cabde3c2551a65d288da455701b920485
JIRA: OVSDB-454
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoAdd support for using epoll Netty transport 62/86162/12
Robert Varga [Tue, 3 Dec 2019 15:54:47 +0000 (16:54 +0100)]
Add support for using epoll Netty transport

Since we have GlobalNettyContext, we can easily provide the necessary
glue to select either epoll(7) or java.nio backend based on availability.

JIRA: OVSDB-331
Change-Id: Id79e13e21dd5bc2358b7a9567bd145a4ca166a39
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoAdd NettyBootstrapFactory to hold OVSDB network threads 61/86161/13
Robert Varga [Tue, 3 Dec 2019 15:26:59 +0000 (16:26 +0100)]
Add NettyBootstrapFactory to hold OVSDB network threads

OvsdbConnectionService is rather bad at using threads efficiently,
as each individual client creates its own EventLoopGroup, which is
not shared with anyone.

This refactors bootstrap generation, so that it is tied to a global
thread factory.

JIRA: OVSDB-411
Change-Id: Ie16e123fa3de87fd4f148c54e610515db3f1de9e
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoReuse StringEncoders for all connections 46/86146/3
Robert Varga [Tue, 3 Dec 2019 14:27:29 +0000 (15:27 +0100)]
Reuse StringEncoders for all connections

StringEncoder is stateless and therefore can be shared across multiple
channel pipelines. Create a single instance for use by all connections.

Change-Id: I660cb90ac3de0476f5637d6a53a8c49826c71f1d
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoReuse MappingJsonFactory across all sessions 43/86143/3
Robert Varga [Tue, 3 Dec 2019 13:35:27 +0000 (14:35 +0100)]
Reuse MappingJsonFactory across all sessions

Heap dump analysis shows we are keeping a per-connection
MappingJsonFactory, which also means we have an ObjectMapper
associated with each connection.

Both MappingJsonFactory and ObjectMapper are documented as
thread-safe and noted to be best shared. Make sure we use a single
instance across all connections.

Change-Id: Ic13ea538eecba9a08d4dba9ac617f2f29abeaba7
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoDo not use reflection in TransactCommandAggregator 04/86104/2
Robert Varga [Mon, 2 Dec 2019 14:59:39 +0000 (15:59 +0100)]
Do not use reflection in TransactCommandAggregator

We are using a simple dispatch to instantiate a known list of
commands. Rather than using reflection, we wire the internal array
to point directly to constructors, allowing us to invoke them without
reflection -- speeding them up, as access checking is not performed
at all. Also fixes a deprecation warning with Java 11.

Change-Id: I3061c3f1ae3a1a4dcc5a3887915ddca9ae6cf2c1
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoFix NPEs in HwvtepOperGlobalListener 02/86102/3
Robert Varga [Mon, 2 Dec 2019 13:26:52 +0000 (14:26 +0100)]
Fix NPEs in HwvtepOperGlobalListener

A connection may not be available form HwvtepConnectionManager, in
which case we would end up throwing a NPE, which floods logs
in HwvtepDataChangeListenerTest. Fix that by checking for missing
connection.

Change-Id: I61a729266948fa1f7cf5eea1ff9c9a674cbad51e
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoMake HwvtepTableReader.alltables a constant 41/86141/3
Robert Varga [Tue, 3 Dec 2019 11:11:29 +0000 (12:11 +0100)]
Make HwvtepTableReader.alltables a constant

This array is treated as a constant source of a stream, turn it
into a proper constant, sharing it among all instances.

Change-Id: Iab1416086deb923fa65d805c075b7acffebb999e
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoUse a singleton list in HwvtepTableReader 40/86140/3
Robert Varga [Tue, 3 Dec 2019 11:06:15 +0000 (12:06 +0100)]
Use a singleton list in HwvtepTableReader

Rather than allocating a full-blown ArrayList, use only a singleton,
saving some memory.

Change-Id: I7505ae7b061d8a410a8df7ef9458e83c560823e2
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoAdd TableSchema.getColumnList() 39/86139/3
Robert Varga [Tue, 3 Dec 2019 11:01:38 +0000 (12:01 +0100)]
Add TableSchema.getColumnList()

There are a number of callers which need to populate the columns
as a List. This adds a simple cached wrapper to allow in-place
reuse of the backing collection.

Change-Id: I3add766905b0a5d520b5cdc8f551fca411e7b137
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoRemove unneeded @SuppressWarnings 37/86137/2
Robert Varga [Tue, 3 Dec 2019 10:04:08 +0000 (11:04 +0100)]
Remove unneeded @SuppressWarnings

Eclipse is pointing these suppressions as superfluous, remove them.

Change-Id: If4caebcb02d338c4bfff4eef2724bce11e0798f2
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoCleanup WhereClausuleGetters 10/86110/2
Robert Varga [Tue, 3 Dec 2019 01:08:46 +0000 (02:08 +0100)]
Cleanup WhereClausuleGetters

The implementation heree could use some love:
- define a dedicated interface place upper bound on polymorphism
- capture InstanceIdentifier type to remove a few casts
- cache associated table in object, removing the need for an
  explicit lookup

Change-Id: Ibd807010ab847d2961bfecb47e262180eac72728
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoUse ClassToInstanceMap for tables 09/86109/1
Robert Varga [Tue, 3 Dec 2019 00:35:25 +0000 (01:35 +0100)]
Use ClassToInstanceMap for tables

This pattern makes it explicit to understand the mapping is
immutable and allows us to remove casts due to use of getInstance().

Change-Id: I6038adb8e4fcda16ab3cfd6c42cf175746130030
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoUse an immutable global type Map 08/86108/1
Robert Varga [Tue, 3 Dec 2019 00:27:38 +0000 (01:27 +0100)]
Use an immutable global type Map

Rather than instantiating and populating this map for each
reader, use a simple constant map. Also clean up map type safety
a bit.

Change-Id: Ia70a9651e3bf27821b937964b63c80d47c7f07a5
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoSpeed up HwvtepTableReader.readAllTables() 07/86107/1
Robert Varga [Tue, 3 Dec 2019 00:09:25 +0000 (01:09 +0100)]
Speed up HwvtepTableReader.readAllTables()

There are two issues here:
- we are using Map.compute() which has needless stores
- we are allocating two capturing lambdas to do that

This refactors the code to use plain imperative style instead
of a stream pipeline. Furthermore it uses a fluent
Map.computeIfAbsent() which results in use of a single
non-capturing lamda.

Change-Id: Iaa92c132bb47076717d9efd3fda50061ecacf085
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoMake RowUpdate immutable and final 06/86106/1
Robert Varga [Tue, 3 Dec 2019 00:06:33 +0000 (01:06 +0100)]
Make RowUpdate immutable and final

Setters are not used anywhere, let's make sure it stays that way,
turning RowUpdate into a plain record.

Change-Id: I596225f70f8232865bac52af3946132f984a7cea
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoRowUpdate should be a static class 05/86105/1
Robert Varga [Mon, 2 Dec 2019 23:51:41 +0000 (00:51 +0100)]
RowUpdate should be a static class

RowUpdate does not reference any TableUpdate state, hence it should
be static. This allows users to shorten their references, as they
do not need to qualify TableUpdate specialization.

Change-Id: I0be3a88623a43df4eaa8abd74ff2ca6732a88e57
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoMake TransactionBuilder type-aware 01/86101/7
Robert Varga [Mon, 2 Dec 2019 12:33:50 +0000 (13:33 +0100)]
Make TransactionBuilder type-aware

This centralizes dispatch to TyperUtils, so that users do not have
to type out acquisition of schema and acquisition of wrapper.

This also allows interception of most calls via normal mocking, as
we can hook into the TransactionBuilder instance -- thus reducing
the need for static mocking.

Change-Id: I9a244be8164ff2dfc1f51edc80b70c4dab635848
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoRework TypedRowInvocationHandler invocation path 84/86084/24
Robert Varga [Sun, 1 Dec 2019 13:34:50 +0000 (14:34 +0100)]
Rework TypedRowInvocationHandler invocation path

Performing schema lookup/validation is something we usually do only
once for a particular schema and then we can freely perform invocation.

Introduce MethodDispatch{Invoker,Prototype} constructs. MethodDispatch
serves as a the result of reflective analysis of a particular access
class.

When TypedDatabaseSchema accesses that class, the MethodDispatch
is loaded from a global cache and is bound to the schema, resulting
in an Invoker map. That map is then used to dispatch InvocationHandler
requests to the appropriate logic.

Change-Id: Ic97751992fea97b01a6fcfd124edbe783bc86e1c
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoMigrate TyperUtils.getTableSchema() users 96/86096/8
Robert Varga [Mon, 2 Dec 2019 02:50:45 +0000 (03:50 +0100)]
Migrate TyperUtils.getTableSchema() users

TypedDatabaseSchema has the same capability, migrate users as they
have this functionality at their fingertip.

Change-Id: I51fa3edb2cfda6894f9f9354ee3ab8dc9bdf7c17
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoSimplify exception instantiation 91/86091/4
Robert Varga [Mon, 2 Dec 2019 01:49:07 +0000 (02:49 +0100)]
Simplify exception instantiation

There is no point in splitting message format, turn a static utility
method to a direct constructor.

Change-Id: I630fa4742f717abe4be021f86d8d78ff76679ef4
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoMigrate TyperUtils methods to TypedDatabaseSchemaImpl 86/86086/11
Robert Varga [Sun, 1 Dec 2019 18:09:17 +0000 (19:09 +0100)]
Migrate TyperUtils methods to TypedDatabaseSchemaImpl

TyperUtils are utterly stateless while TypedDatabaseSchema can
provide schema binding. Migrate method implementatios there, leaving
a simple lookup compability layer in TyperUtils.

Change-Id: If533c8fd8fe0027e8ca67dcd474b8b92fbadd767
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoMake OvsdbClient return TypedDatabaseSchemas 83/86083/10
Robert Varga [Sun, 1 Dec 2019 11:17:01 +0000 (12:17 +0100)]
Make OvsdbClient return TypedDatabaseSchemas

Centralizing type-safety in client is beneficial in that the users
can use type mapping directly, without having to go through
TyperUtils.

Change-Id: I0f620e515ecb7f9bd140155c046a2c4bf9dc447f
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoExtract TypedRowInvocationHandler 81/86081/12
Robert Varga [Sun, 1 Dec 2019 10:33:02 +0000 (11:33 +0100)]
Extract TypedRowInvocationHandler

The InvocationHandler used in TyperUtils has significant
functionality, which we want to further extend/optimize. Split it
out into its own class.

Change-Id: I6406150799d805b2c2e0867a37205f54ec1c10bd
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoEliminate OvsdbClientImpl duplication 90/86090/5
Robert Varga [Mon, 2 Dec 2019 01:09:25 +0000 (02:09 +0100)]
Eliminate OvsdbClientImpl duplication

CPD is pointing out a trivial duplication of monitor(). Fix that
by properly reusing the more flexible version().

Change-Id: I6bfd80ada7d8d2b1fe3f20007d933dd9be9c03b5
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoUse String.getBytes(CharSet) 89/86089/4
Robert Varga [Mon, 2 Dec 2019 00:46:22 +0000 (01:46 +0100)]
Use String.getBytes(CharSet)

Modernizer is point out this improved method, use it instead of
String-specified charset.

Change-Id: I852152d52566e41b8363c06d8c007a7d1448c305
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoDe-confuse InvocationHandler and target methods 80/86080/8
Robert Varga [Sun, 1 Dec 2019 10:04:32 +0000 (11:04 +0100)]
De-confuse InvocationHandler and target methods

Having hashCode()/equals()/toString() implemented in InvocationHandler
could lead to confusing the handler with the object being proxied. It
furthermore violates equality contract requirement of being reflexive
-- the handler ends up being equal to other implementations of proxied
interface, but any other implementation would either have to handle
it specifically, or will determined it being non-equal.

Clean up the confusion by renaming the methods and have default
implementations take over. This is explicitly fine, as we do not have
any code accessing the handler directly, only through the proxy.
This also eliminates the need to suppress warnings.

Change-Id: Iac42d09b5a44716e8293c6b1e9003a780efae6f8
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoHide TyperUtils.extractRowUpdates() 79/86079/9
Robert Varga [Sun, 1 Dec 2019 09:45:47 +0000 (10:45 +0100)]
Hide TyperUtils.extractRowUpdates()

This is an internal utility method not used anywhere else, hide
it.

Change-Id: Ie3d7f0d7d2496bb17f323bb5f0848fc88a61b511
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoAdd TypedReflections 77/86077/12
Robert Varga [Sat, 30 Nov 2019 12:27:24 +0000 (13:27 +0100)]
Add TypedReflections

We have multiple places which are accessing annotation-based type
information. This provides a single place to obtain that information.

As we have proper encapsulation, add caches for table/column
versions. Since we are dealing with Version, this class is updated
to be immutable and provide a Range<Version> factory.

Change-Id: I5c2f1d3553392cbd222a1927fdd36564f895475b
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoAdd @NonNull annotation to OvsdbConnectionListener.connected() 82/86082/2
Robert Varga [Sun, 1 Dec 2019 11:30:18 +0000 (12:30 +0100)]
Add @NonNull annotation to OvsdbConnectionListener.connected()

Eclipse warns about users overriding unconstrained parameter here,
and we know the instance will not be null. Propagate @NonNull to
the API specification, fixing warnings.

This also fixes similar warnings in other places.

Change-Id: I6cf71c4c0495ba0358157ee12e92b9a7a665b92c
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoAdd TypedDatabaseSchema 76/86076/6
Robert Varga [Sat, 30 Nov 2019 11:22:10 +0000 (12:22 +0100)]
Add TypedDatabaseSchema

This adds a new entrypoint for performing typed operations on top
of DatabaseSchema. The implementation fowards to TyperUtils, allowing
transition away from those utilities.

OvsdbClientImpl is update to always return TypedDatabaseSchema and
use it to implement its interface.

Change-Id: I6e31f418b2acdebdca01181522b6bb7966061617
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoTurn DatabaseSchema into an interface 75/86075/3
Robert Varga [Sat, 30 Nov 2019 10:04:23 +0000 (11:04 +0100)]
Turn DatabaseSchema into an interface

This moves all the implementation details out into a separate class,
allowing DatabaseSchema interface to be extended with additional
functionality.

Change-Id: Ib7a0124993cb89bb448b3c08bda6c6de0fea1dde
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoMake TableSchema/DatabaseSchema immutable 74/86074/2
Robert Varga [Sat, 30 Nov 2019 08:26:00 +0000 (09:26 +0100)]
Make TableSchema/DatabaseSchema immutable

Having schemas completely immutable is beneficial, as we can
propagate invariants properly. This patch makes TableSchema
and DatabaseSchema use immutable maps internally, making sure
the final bit is achieved.

Change-Id: Ie7c9fd4aa9cba7f0af88c8886400e8e5c804d6af
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoSplit out BaseTypeFactories 71/86071/5
Robert Varga [Fri, 29 Nov 2019 15:27:50 +0000 (16:27 +0100)]
Split out BaseTypeFactories

Instantiating BaseTypes with complex definition is a prime example
of where either a builder or a factory pattern is appropriate. Given
we are dealing with a few types with very few customizations, this
patch applies the factory pattern to the problem.

This makes all BaseType subclasses properly immutable and has the
benefit of squashing instances to singletons when they are not
otherwise customized.

Change-Id: I86d09324624c1e5b1a73a0be31269f2233fc15b3
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoUse singleton BaseType instances for simple definitions 68/86068/3
Robert Varga [Fri, 29 Nov 2019 14:56:12 +0000 (15:56 +0100)]
Use singleton BaseType instances for simple definitions

We have two distinct cases for a type definition. It is either
a simple reference without any further constraints or it is
customized in some way.

This patch separates the two codepaths, making the former use
singleton instances.

Change-Id: Ic9e63f2320a429bda076e4ae25eea97e5242a52c
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>