Reject multiple sessions with the same host key 45/87545/7
authorManoj Chokka <manoj.chokka@verizon.com>
Mon, 10 Feb 2020 18:15:34 +0000 (23:45 +0530)
committerRobert Varga <robert.varga@pantheon.tech>
Tue, 3 Mar 2020 21:10:02 +0000 (22:10 +0100)
commit547c1ddb9d8794c4cd40b16a88a28e337dfb7730
treeeb3043c9c661d708c8aad2c0320d36a3872c4cce
parentf6ed2c031cd5c4e9acf70586a648af434f1be5f0
Reject multiple sessions with the same host key

SSH host key is supposed to be unique among devices. If there is an
attempt to establish a session with the same key, terminate the new
session.

Since that rules out the possibility of multiple remotes for a key,
refactor the code to use a ConcurrentMap instead of a Multimap --
removing the need for any locking.

As we really want to use CallHomeProtocolSessionContext in logging,
make it implement a toString() method and clean it up a bit.

JIRA: NETCONF-653
Change-Id: I2d78b9aa34ee4b16d0c6d2ed2ac172942c575851
Signed-off-by: Manoj Chokka <manoj.chokka@verizon.com>
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
netconf/callhome-protocol/src/main/java/org/opendaylight/netconf/callhome/protocol/CallHomeProtocolSessionContext.java
netconf/callhome-protocol/src/main/java/org/opendaylight/netconf/callhome/protocol/CallHomeSessionContext.java
netconf/callhome-provider/src/main/java/org/opendaylight/netconf/callhome/mount/CallHomeMountDispatcher.java
netconf/callhome-provider/src/main/java/org/opendaylight/netconf/callhome/mount/CallHomeMountSessionContext.java
netconf/callhome-provider/src/main/java/org/opendaylight/netconf/callhome/mount/CallHomeMountSessionManager.java