2 * Copyright (c) 2015 Cisco Systems, Inc. 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 org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.mapping.database.rev150314.AddKeyInput;
11 import org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.mapping.database.rev150314.AddMappingInput;
12 import org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.mapping.database.rev150314.EidUri;
13 import org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.mapping.database.rev150314.MappingOrigin;
14 import org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.mapping.database.rev150314.RemoveKeyInput;
15 import org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.mapping.database.rev150314.RemoveMappingInput;
16 import org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.mapping.database.rev150314.UpdateKeyInput;
17 import org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.mapping.database.rev150314.UpdateMappingInput;
18 import org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.mapping.database.rev150314.db.instance.AuthenticationKey;
19 import org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.mapping.database.rev150314.db.instance.AuthenticationKeyBuilder;
20 import org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.mapping.database.rev150314.db.instance.Mapping;
21 import org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.mapping.database.rev150314.db.instance.MappingBuilder;
24 * Converts RPC *Input object to other object types
26 * @author Lorand Jakab
29 public class RPCInputConvertorUtil {
30 public static AuthenticationKey toAuthenticationKey(AddKeyInput input) {
31 AuthenticationKeyBuilder akb = new AuthenticationKeyBuilder();
32 akb.setEid(new EidUri(LispAddressStringifier.getURIString(
33 input.getLispAddressContainer(), input.getMaskLength())));
34 akb.setLispAddressContainer(input.getLispAddressContainer());
35 akb.setMaskLength(input.getMaskLength());
36 akb.setKeyType(input.getKeyType());
37 akb.setAuthkey(input.getAuthkey());
41 public static AuthenticationKey toAuthenticationKey(UpdateKeyInput input) {
42 AuthenticationKeyBuilder akb = new AuthenticationKeyBuilder();
43 akb.setEid(new EidUri(LispAddressStringifier.getURIString(
44 input.getEid().getLispAddressContainer(), input.getEid().getMaskLength())));
45 akb.setLispAddressContainer(input.getEid().getLispAddressContainer());
46 akb.setMaskLength(input.getEid().getMaskLength());
47 akb.setKeyType(input.getKey().getKeyType());
48 akb.setAuthkey(input.getKey().getAuthkey());
52 public static AuthenticationKey toAuthenticationKey(RemoveKeyInput input) {
53 AuthenticationKeyBuilder akb = new AuthenticationKeyBuilder();
54 akb.setEid(new EidUri(LispAddressStringifier.getURIString(
55 input.getLispAddressContainer(), input.getMaskLength())));
56 akb.setLispAddressContainer(input.getLispAddressContainer());
57 akb.setMaskLength(input.getMaskLength());
61 public static Mapping toMapping(AddMappingInput input) {
62 MappingBuilder mb = new MappingBuilder();
63 mb.setEid(new EidUri(LispAddressStringifier.getURIString(
64 input.getLispAddressContainer(), input.getMaskLength())));
65 mb.setOrigin(MappingOrigin.Northbound);
66 mb.setRecordTtl(input.getRecordTtl());
67 mb.setMaskLength(input.getMaskLength());
68 mb.setMapVersion(input.getMapVersion());
69 mb.setAction(input.getAction());
70 mb.setAuthoritative(input.isAuthoritative());
71 mb.setLispAddressContainer(input.getLispAddressContainer());
72 mb.setLocatorRecord(input.getLocatorRecord());
76 public static Mapping toMapping(UpdateMappingInput input) {
77 MappingBuilder mb = new MappingBuilder();
78 mb.setEid(new EidUri(LispAddressStringifier.getURIString(
79 input.getLispAddressContainer(), input.getMaskLength())));
80 mb.setOrigin(MappingOrigin.Northbound);
81 mb.setRecordTtl(input.getRecordTtl());
82 mb.setMaskLength(input.getMaskLength());
83 mb.setMapVersion(input.getMapVersion());
84 mb.setAction(input.getAction());
85 mb.setAuthoritative(input.isAuthoritative());
86 mb.setLispAddressContainer(input.getLispAddressContainer());
87 mb.setLocatorRecord(input.getLocatorRecord());
91 public static Mapping toMapping(RemoveMappingInput input) {
92 MappingBuilder mb = new MappingBuilder();
93 mb.setEid(new EidUri(LispAddressStringifier.getURIString(
94 input.getLispAddressContainer(), input.getMaskLength())));
95 mb.setOrigin(MappingOrigin.Northbound);
96 mb.setMaskLength(input.getMaskLength());
97 mb.setLispAddressContainer(input.getLispAddressContainer());