Merge "Patch Set 1: Add postman collection for HwvtepSouthbound"
[ovsdb.git] / hwvtepsouthbound / hwvtepsouthbound-impl / src / main / java / org / opendaylight / ovsdb / hwvtepsouthbound / HwvtepConnectionManager.java
1 /*
2  * Copyright (c) 2015 Ericsson India Global Services Pvt Ltd. and others.  All rights reserved.
3  *
4  * This program and the accompanying materials are made available under the
5  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
6  * and is available at http://www.eclipse.org/legal/epl-v10.html
7  */
8
9 package org.opendaylight.ovsdb.hwvtepsouthbound;
10
11 import static org.opendaylight.ovsdb.lib.operations.Operations.op;
12
13 import java.net.InetAddress;
14 import java.net.UnknownHostException;
15 import java.util.ArrayList;
16 import java.util.List;
17 import java.util.Map;
18 import java.util.concurrent.ConcurrentHashMap;
19 import java.util.concurrent.ExecutionException;
20
21 import javax.annotation.Nonnull;
22
23 import org.opendaylight.controller.md.sal.binding.api.DataBroker;
24 import org.opendaylight.controller.md.sal.binding.api.ReadOnlyTransaction;
25 import org.opendaylight.controller.md.sal.binding.api.ReadWriteTransaction;
26 import org.opendaylight.controller.md.sal.common.api.clustering.CandidateAlreadyRegisteredException;
27 import org.opendaylight.controller.md.sal.common.api.clustering.Entity;
28 import org.opendaylight.controller.md.sal.common.api.clustering.EntityOwnershipCandidateRegistration;
29 import org.opendaylight.controller.md.sal.common.api.clustering.EntityOwnershipChange;
30 import org.opendaylight.controller.md.sal.common.api.clustering.EntityOwnershipListener;
31 import org.opendaylight.controller.md.sal.common.api.clustering.EntityOwnershipListenerRegistration;
32 import org.opendaylight.controller.md.sal.common.api.clustering.EntityOwnershipService;
33 import org.opendaylight.controller.md.sal.common.api.clustering.EntityOwnershipState;
34 import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType;
35 import org.opendaylight.controller.md.sal.common.api.data.ReadFailedException;
36 import org.opendaylight.ovsdb.hwvtepsouthbound.transactions.md.HwvtepGlobalRemoveCommand;
37 import org.opendaylight.ovsdb.hwvtepsouthbound.transactions.md.PhysicalSwitchRemoveCommand;
38 import org.opendaylight.ovsdb.hwvtepsouthbound.transactions.md.TransactionInvoker;
39 import org.opendaylight.ovsdb.lib.OvsdbClient;
40 import org.opendaylight.ovsdb.lib.OvsdbConnectionListener;
41 import org.opendaylight.ovsdb.lib.impl.OvsdbConnectionService;
42 import org.opendaylight.ovsdb.lib.operations.Operation;
43 import org.opendaylight.ovsdb.lib.operations.OperationResult;
44 import org.opendaylight.ovsdb.lib.operations.Select;
45 import org.opendaylight.ovsdb.lib.schema.DatabaseSchema;
46 import org.opendaylight.ovsdb.lib.schema.GenericTableSchema;
47 import org.opendaylight.ovsdb.lib.schema.typed.TyperUtils;
48 import org.opendaylight.ovsdb.schema.hardwarevtep.Global;
49 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.hwvtep.rev150901.HwvtepGlobalAugmentation;
50 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.hwvtep.rev150901.HwvtepPhysicalSwitchAttributes;
51 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.hwvtep.rev150901.PhysicalSwitchAugmentation;
52 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.hwvtep.rev150901.hwvtep.global.attributes.ConnectionInfo;
53 import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.Node;
54 import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
55 import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
56 import org.slf4j.Logger;
57 import org.slf4j.LoggerFactory;
58
59 import com.google.common.base.Optional;
60 import com.google.common.base.Preconditions;
61 import com.google.common.util.concurrent.CheckedFuture;
62
63 public class HwvtepConnectionManager implements OvsdbConnectionListener, AutoCloseable{
64     private Map<ConnectionInfo, HwvtepConnectionInstance> clients =
65                     new ConcurrentHashMap<ConnectionInfo,HwvtepConnectionInstance>();
66     private static final Logger LOG = LoggerFactory.getLogger(HwvtepConnectionManager.class);
67     private static final String ENTITY_TYPE = "hwvtep";
68
69     private DataBroker db;
70     private TransactionInvoker txInvoker;
71     private Map<ConnectionInfo,InstanceIdentifier<Node>> instanceIdentifiers =
72                     new ConcurrentHashMap<ConnectionInfo,InstanceIdentifier<Node>>();
73     private Map<Entity, HwvtepConnectionInstance> entityConnectionMap =
74                     new ConcurrentHashMap<>();
75     private EntityOwnershipService entityOwnershipService;
76     private HwvtepDeviceEntityOwnershipListener hwvtepDeviceEntityOwnershipListener;
77
78     public HwvtepConnectionManager(DataBroker db, TransactionInvoker txInvoker,
79                     EntityOwnershipService entityOwnershipService) {
80         this.db = db;
81         this.txInvoker = txInvoker;
82         this.entityOwnershipService = entityOwnershipService;
83         this.hwvtepDeviceEntityOwnershipListener = new HwvtepDeviceEntityOwnershipListener(this,entityOwnershipService);
84     }
85
86     @Override
87     public void close() throws Exception {
88         if (hwvtepDeviceEntityOwnershipListener != null) {
89             hwvtepDeviceEntityOwnershipListener.close();
90         }
91
92         for (OvsdbClient client: clients.values()) {
93             client.disconnect();
94         }
95     }
96
97     @Override
98     public void connected(@Nonnull final OvsdbClient client) {
99         HwvtepConnectionInstance hwClient = connectedButCallBacksNotRegistered(client);
100         registerEntityForOwnership(hwClient);
101         LOG.trace("connected client: {}", client);
102     }
103
104     @Override
105     public void disconnected(OvsdbClient client) {
106         LOG.info("HWVTEP Disconnected from {}:{}. Cleaning up the operational data store"
107                         ,client.getConnectionInfo().getRemoteAddress(),
108                         client.getConnectionInfo().getRemotePort());
109         ConnectionInfo key = HwvtepSouthboundMapper.createConnectionInfo(client);
110         HwvtepConnectionInstance hwvtepConnectionInstance = getConnectionInstance(key);
111         if (hwvtepConnectionInstance != null) {
112             //TODO: remove all the hwvtep nodes
113             txInvoker.invoke(new HwvtepGlobalRemoveCommand(hwvtepConnectionInstance, null, null));
114             removeConnectionInstance(key);
115
116             // Unregister Cluster Ownership for ConnectionInfo
117             unregisterEntityForOwnership(hwvtepConnectionInstance);
118         } else {
119             LOG.warn("HWVTEP disconnected event did not find connection instance for {}", key);
120         }
121         LOG.trace("disconnected client: {}", client);
122     }
123
124     public OvsdbClient connect(InstanceIdentifier<Node> iid, HwvtepGlobalAugmentation hwvtepGlobal) throws UnknownHostException {
125         InetAddress ip = HwvtepSouthboundMapper.createInetAddress(hwvtepGlobal.getConnectionInfo().getRemoteIp());
126         OvsdbClient client = OvsdbConnectionService.getService()
127                         .connect(ip, hwvtepGlobal.getConnectionInfo().getRemotePort().getValue());
128         if(client != null) {
129             putInstanceIdentifier(hwvtepGlobal.getConnectionInfo(), iid.firstIdentifierOf(Node.class));
130             HwvtepConnectionInstance hwvtepConnectionInstance = connectedButCallBacksNotRegistered(client);
131             hwvtepConnectionInstance.setHwvtepGlobalAugmentation(hwvtepGlobal);
132             hwvtepConnectionInstance.setInstanceIdentifier(iid.firstIdentifierOf(Node.class));
133
134             // Register Cluster Ownership for ConnectionInfo
135             registerEntityForOwnership(hwvtepConnectionInstance);
136         } else {
137             LOG.warn("Failed to connect to OVSDB node: {}", hwvtepGlobal.getConnectionInfo());
138         }
139         return client;
140     }
141     public void disconnect(HwvtepGlobalAugmentation ovsdbNode) throws UnknownHostException {
142         HwvtepConnectionInstance client = getConnectionInstance(ovsdbNode.getConnectionInfo());
143         if (client != null) {
144             client.disconnect();
145             // Unregister Cluster Ownership for ConnectionInfo
146             unregisterEntityForOwnership(client);
147             removeInstanceIdentifier(ovsdbNode.getConnectionInfo());
148         }
149     }
150
151     public HwvtepConnectionInstance connectedButCallBacksNotRegistered(final OvsdbClient externalClient) {
152         LOG.info("OVSDB Connection from {}:{}",externalClient.getConnectionInfo().getRemoteAddress(),
153                 externalClient.getConnectionInfo().getRemotePort());
154         ConnectionInfo key = HwvtepSouthboundMapper.createConnectionInfo(externalClient);
155         HwvtepConnectionInstance hwvtepConnectionInstance = getConnectionInstance(key);
156
157         // Check if existing hwvtepConnectionInstance for the OvsdbClient present.
158         // In such cases, we will see if the hwvtepConnectionInstance has same externalClient.
159         if (hwvtepConnectionInstance != null) {
160             if (hwvtepConnectionInstance.hasOvsdbClient(externalClient)) {
161                 LOG.warn("HWVTEP Connection Instance {} already exists for client {}", key, externalClient);
162                 return hwvtepConnectionInstance;
163             }
164             LOG.warn("HWVTEP Connection Instance {} being replaced with client {}", key, externalClient);
165             hwvtepConnectionInstance.disconnect();
166
167             // Unregister Cluster Ownership for ConnectionInfo
168             // Because the hwvtepConnectionInstance is about to be completely replaced!
169             unregisterEntityForOwnership(hwvtepConnectionInstance);
170
171             removeConnectionInstance(key);
172         }
173
174         hwvtepConnectionInstance = new HwvtepConnectionInstance(key, externalClient, getInstanceIdentifier(key),
175                 txInvoker);
176         hwvtepConnectionInstance.createTransactInvokers();
177         return hwvtepConnectionInstance;
178     }
179
180     private void putConnectionInstance(ConnectionInfo key,HwvtepConnectionInstance instance) {
181         ConnectionInfo connectionInfo = HwvtepSouthboundMapper.suppressLocalIpPort(key);
182         clients.put(connectionInfo, instance);
183         LOG.info("Clients after put: {}", clients);
184     }
185
186     public HwvtepConnectionInstance getConnectionInstance(ConnectionInfo key) {
187         ConnectionInfo connectionInfo = HwvtepSouthboundMapper.suppressLocalIpPort(key);
188         return clients.get(connectionInfo);
189     }
190
191     public HwvtepConnectionInstance getConnectionInstance(Node node) {
192         Preconditions.checkNotNull(node);
193         HwvtepGlobalAugmentation hwvtepGlobal = node.getAugmentation(HwvtepGlobalAugmentation.class);
194         PhysicalSwitchAugmentation pSwitchNode = node.getAugmentation(PhysicalSwitchAugmentation.class);
195         if (hwvtepGlobal != null) {
196             return getConnectionInstance(hwvtepGlobal.getConnectionInfo());
197         } //TODO: We could get it from Managers also.
198         else if(pSwitchNode != null){
199             return getConnectionInstance(pSwitchNode);
200         } else {
201             LOG.warn("This is not a node that gives any hint how to find its OVSDB Manager: {}",node);
202             return null;
203         }
204     }
205
206     public HwvtepConnectionInstance getConnectionInstance(InstanceIdentifier<Node> nodePath) {
207         try {
208             ReadOnlyTransaction transaction = db.newReadOnlyTransaction();
209             CheckedFuture<Optional<Node>, ReadFailedException> nodeFuture = transaction.read(
210                     LogicalDatastoreType.OPERATIONAL, nodePath);
211             transaction.close();
212             Optional<Node> optional = nodeFuture.get();
213             if (optional != null && optional.isPresent() && optional.get() instanceof Node) {
214                 return this.getConnectionInstance(optional.get());
215             } else {
216                 LOG.warn("Found non-topological node {} on path {}",optional);
217                 return null;
218             }
219         } catch (Exception e) {
220             LOG.warn("Failed to get Hwvtep Node {}",nodePath, e);
221             return null;
222         }
223     }
224
225     private HwvtepConnectionInstance getConnectionInstance(HwvtepPhysicalSwitchAttributes pNode) {
226         Optional<HwvtepGlobalAugmentation> optional = HwvtepSouthboundUtil.getManagingNode(db, pNode);
227         if(optional.isPresent()) {
228             return getConnectionInstance(optional.get().getConnectionInfo());
229         } else {
230             return null;
231         }
232     }
233
234     private void removeConnectionInstance(ConnectionInfo key) {
235         ConnectionInfo connectionInfo = HwvtepSouthboundMapper.suppressLocalIpPort(key);
236         clients.remove(connectionInfo);
237         LOG.info("Clients after remove: {}", clients);
238     }
239
240     private void putInstanceIdentifier(ConnectionInfo key,InstanceIdentifier<Node> iid) {
241         ConnectionInfo connectionInfo = HwvtepSouthboundMapper.suppressLocalIpPort(key);
242         instanceIdentifiers.put(connectionInfo, iid);
243     }
244
245     public InstanceIdentifier<Node> getInstanceIdentifier(ConnectionInfo key) {
246         ConnectionInfo connectionInfo = HwvtepSouthboundMapper.suppressLocalIpPort(key);
247         InstanceIdentifier<Node> iid = instanceIdentifiers.get(connectionInfo);
248         return iid;
249     }
250
251     private void removeInstanceIdentifier(ConnectionInfo key) {
252         ConnectionInfo connectionInfo = HwvtepSouthboundMapper.suppressLocalIpPort(key);
253         instanceIdentifiers.remove(connectionInfo);
254     }
255
256     public OvsdbClient getClient(ConnectionInfo connectionInfo) {
257         return getConnectionInstance(connectionInfo);
258     }
259
260     private void registerEntityForOwnership(HwvtepConnectionInstance hwvtepConnectionInstance) {
261
262         Entity candidateEntity = getEntityFromConnectionInstance(hwvtepConnectionInstance);
263         entityConnectionMap.put(candidateEntity, hwvtepConnectionInstance);
264         hwvtepConnectionInstance.setConnectedEntity(candidateEntity);
265
266         try {
267             EntityOwnershipCandidateRegistration registration =
268                     entityOwnershipService.registerCandidate(candidateEntity);
269             hwvtepConnectionInstance.setDeviceOwnershipCandidateRegistration(registration);
270             LOG.info("HWVTEP entity {} is registered for ownership.", candidateEntity);
271
272             //If entity already has owner, it won't get notification from EntityOwnershipService
273             //so cache the connection instances.
274             Optional<EntityOwnershipState> ownershipStateOpt =
275                     entityOwnershipService.getOwnershipState(candidateEntity);
276             if (ownershipStateOpt.isPresent()) {
277                 EntityOwnershipState ownershipState = ownershipStateOpt.get();
278                 if (ownershipState.hasOwner() && !ownershipState.isOwner()) {
279                     if (getConnectionInstance(hwvtepConnectionInstance.getMDConnectionInfo()) != null) {
280                         LOG.info("OVSDB entity {} is already owned by other southbound plugin "
281                                 + "instance, so *this* instance is NOT an OWNER of the device",
282                                 hwvtepConnectionInstance.getConnectionInfo());
283                         putConnectionInstance(hwvtepConnectionInstance.getMDConnectionInfo(),hwvtepConnectionInstance);
284                     }
285                 }
286             }
287         } catch (CandidateAlreadyRegisteredException e) {
288             LOG.warn("OVSDB entity {} was already registered for {} ownership", candidateEntity, e);
289         }
290
291     }
292
293     private Global getHwvtepGlobalTableEntry(HwvtepConnectionInstance connectionInstance) {
294         DatabaseSchema dbSchema = null;
295         Global globalRow = null;
296
297         try {
298             dbSchema = connectionInstance.getSchema(HwvtepSchemaConstants.databaseName).get();
299         } catch (InterruptedException | ExecutionException e) {
300             LOG.warn("Not able to fetch schema for database {} from device {}",
301                     HwvtepSchemaConstants.databaseName,connectionInstance.getConnectionInfo(),e);
302         }
303
304         if (dbSchema != null) {
305             GenericTableSchema hwvtepSchema = TyperUtils.getTableSchema(dbSchema, Global.class);
306
307             List<String> hwvtepTableColumn = new ArrayList<String>();
308             hwvtepTableColumn.addAll(hwvtepSchema.getColumns());
309             Select<GenericTableSchema> selectOperation = op.select(hwvtepSchema);
310             selectOperation.setColumns(hwvtepTableColumn);;
311
312             ArrayList<Operation> operations = new ArrayList<Operation>();
313             operations.add(selectOperation);
314             operations.add(op.comment("Fetching hardware_vtep table rows"));
315
316             List<OperationResult> results = null;
317             try {
318                 results = connectionInstance.transact(dbSchema, operations).get();
319                 if (results != null ) {
320                     OperationResult selectResult = results.get(0);
321                     globalRow = TyperUtils.getTypedRowWrapper(
322                             dbSchema,Global.class,selectResult.getRows().get(0));
323                 }
324             } catch (InterruptedException | ExecutionException e) {
325                 LOG.warn("Not able to fetch hardware_vtep table row from device {}",
326                         connectionInstance.getConnectionInfo(),e);
327             }
328         }
329         LOG.trace("Fetched global {} from hardware_vtep schema",globalRow);
330         return globalRow;
331     }
332
333     private Entity getEntityFromConnectionInstance(@Nonnull HwvtepConnectionInstance hwvtepConnectionInstance) {
334         YangInstanceIdentifier entityId = null;
335         InstanceIdentifier<Node> iid = hwvtepConnectionInstance.getInstanceIdentifier();
336         if ( iid == null ) {
337             //TODO: Is Global the right one?
338             Global hwvtepGlobalRow = getHwvtepGlobalTableEntry(hwvtepConnectionInstance);
339             iid = HwvtepSouthboundMapper.getInstanceIdentifier(hwvtepGlobalRow);
340             /* Let's set the iid now */
341             hwvtepConnectionInstance.setInstanceIdentifier(iid);
342             LOG.info("InstanceIdentifier {} generated for device "
343                     + "connection {}",iid, hwvtepConnectionInstance.getConnectionInfo());
344
345         }
346         entityId = HwvtepSouthboundUtil.getInstanceIdentifierCodec().getYangInstanceIdentifier(iid);
347         Entity deviceEntity = new Entity(ENTITY_TYPE, entityId);
348         LOG.debug("Entity {} created for device connection {}",
349                 deviceEntity, hwvtepConnectionInstance.getConnectionInfo());
350         return deviceEntity;
351     }
352     private void unregisterEntityForOwnership(HwvtepConnectionInstance hwvtepConnectionInstance) {
353         hwvtepConnectionInstance.closeDeviceOwnershipCandidateRegistration();
354         entityConnectionMap.remove(hwvtepConnectionInstance.getConnectedEntity());
355     }
356
357     public void handleOwnershipChanged(EntityOwnershipChange ownershipChange) {
358         HwvtepConnectionInstance hwvtepConnectionInstance = getConnectionInstanceFromEntity(ownershipChange.getEntity());
359         LOG.info("handleOwnershipChanged: {} event received for device {}",
360                 ownershipChange, hwvtepConnectionInstance != null ? hwvtepConnectionInstance.getConnectionInfo()
361                         : "THAT'S NOT REGISTERED BY THIS SOUTHBOUND PLUGIN INSTANCE");
362
363         if (hwvtepConnectionInstance == null) {
364             if (ownershipChange.isOwner()) {
365                 LOG.warn("handleOwnershipChanged: found no connection instance for {}", ownershipChange.getEntity());
366             } else {
367                 // EntityOwnershipService sends notification to all the nodes, irrespective of whether
368                 // that instance registered for the device ownership or not. It is to make sure that
369                 // If all the controller instance that was connected to the device are down, so the
370                 // running instance can clear up the operational data store even though it was not
371                 // connected to the device.
372                 LOG.debug("handleOwnershipChanged: found no connection instance for {}", ownershipChange.getEntity());
373             }
374
375             // If entity has no owner, clean up the operational data store (it's possible because owner controller
376             // might went down abruptly and didn't get a chance to clean up the operational data store.
377             if (!ownershipChange.hasOwner()) {
378                 LOG.debug("{} has no owner, cleaning up the operational data store", ownershipChange.getEntity());
379                 // Below code might look weird but it's required. We want to give first opportunity to the
380                 // previous owner of the device to clean up the operational data store if there is no owner now.
381                 // That way we will avoid lot of nasty md-sal exceptions because of concurrent delete.
382                 if (ownershipChange.wasOwner()) {
383                     cleanEntityOperationalData(ownershipChange.getEntity());
384                 }
385                 // If first cleanEntityOperationalData() was called, this call will be no-op.
386                 cleanEntityOperationalData(ownershipChange.getEntity());
387             }
388             return;
389         }
390         //Connection detail need to be cached, irrespective of ownership result.
391         putConnectionInstance(hwvtepConnectionInstance.getMDConnectionInfo(),hwvtepConnectionInstance);
392
393         if (ownershipChange.isOwner() == hwvtepConnectionInstance.getHasDeviceOwnership()) {
394             LOG.debug("handleOwnershipChanged: no change in ownership for {}. Ownership status is : {}",
395                     hwvtepConnectionInstance.getConnectionInfo(), hwvtepConnectionInstance.getHasDeviceOwnership());
396             return;
397         }
398
399         hwvtepConnectionInstance.setHasDeviceOwnership(ownershipChange.isOwner());
400         // You were not an owner, but now you are
401         if (ownershipChange.isOwner()) {
402             LOG.info("handleOwnershipChanged: *this* southbound plugin instance is owner of device {}",
403                     hwvtepConnectionInstance.getConnectionInfo());
404
405             //*this* instance of southbound plugin is owner of the device,
406             //so register for monitor callbacks
407             hwvtepConnectionInstance.registerCallbacks();
408
409         } else {
410             //You were owner of the device, but now you are not. With the current ownership
411             //grant mechanism, this scenario should not occur. Because this scenario will occur
412             //when this controller went down or switch flap the connection, but in both the case
413             //it will go through the re-registration process. We need to implement this condition
414             //when clustering service implement a ownership grant strategy which can revoke the
415             //device ownership for load balancing the devices across the instances.
416             //Once this condition occur, we should unregister the callback.
417             LOG.error("handleOwnershipChanged: *this* southbound plugin instance is no longer the owner of device {}",
418                     hwvtepConnectionInstance.getNodeId().getValue());
419         }
420     }
421
422     private void cleanEntityOperationalData(Entity entity) {
423         InstanceIdentifier<Node> nodeIid = (InstanceIdentifier<Node>) HwvtepSouthboundUtil
424                 .getInstanceIdentifierCodec().bindingDeserializer(entity.getId());
425
426         final ReadWriteTransaction transaction = db.newReadWriteTransaction();
427         Optional<Node> node = HwvtepSouthboundUtil.readNode(transaction, nodeIid);
428         if (node.isPresent()) {
429             HwvtepSouthboundUtil.deleteNode(transaction, nodeIid);
430         }
431     }
432
433     private HwvtepConnectionInstance getConnectionInstanceFromEntity(Entity entity) {
434         return entityConnectionMap.get(entity);
435     }
436
437     private class HwvtepDeviceEntityOwnershipListener implements EntityOwnershipListener {
438         private HwvtepConnectionManager hcm;
439         private EntityOwnershipListenerRegistration listenerRegistration;
440
441         HwvtepDeviceEntityOwnershipListener(HwvtepConnectionManager hcm, EntityOwnershipService entityOwnershipService) {
442             this.hcm = hcm;
443             listenerRegistration = entityOwnershipService.registerListener(ENTITY_TYPE, this);
444         }
445         public void close() {
446             listenerRegistration.close();
447         }
448         @Override
449         public void ownershipChanged(EntityOwnershipChange ownershipChange) {
450             hcm.handleOwnershipChanged(ownershipChange);
451         }
452     }
453
454 }