2 * Copyright (c) 2014 Contextream, Inc. and others. All rights reserved.
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
8 package org.opendaylight.lispflowmapping.implementation.util;
10 import java.util.ArrayList;
11 import java.util.Arrays;
13 import org.opendaylight.yang.gen.v1.lispflowmapping.rev131031.MapRegister;
14 import org.opendaylight.yang.gen.v1.lispflowmapping.rev131031.eidtolocatorrecords.EidToLocatorRecord;
15 import org.opendaylight.yang.gen.v1.lispflowmapping.rev131031.mapnotifymessage.MapNotifyBuilder;
17 public class MapNotifyBuilderHelper {
19 public static void setFromMapRegister(MapNotifyBuilder builder, MapRegister mapRegister) {
20 if (builder.getEidToLocatorRecord() == null) {
21 builder.setEidToLocatorRecord(new ArrayList<EidToLocatorRecord>());
23 builder.setNonce(mapRegister.getNonce());
24 builder.setKeyId(mapRegister.getKeyId());
25 byte[] authenticationData = mapRegister.getAuthenticationData();
26 if (authenticationData != null) {
27 authenticationData = authenticationData.clone();
28 Arrays.fill(authenticationData, (byte) 0);
30 builder.setAuthenticationData(authenticationData);
32 for (EidToLocatorRecord eidToLocator : mapRegister.getEidToLocatorRecord()) {
33 builder.getEidToLocatorRecord().add(eidToLocator);