Fix of Lisp commands for DVR
[groupbasedpolicy.git] / renderers / vpp / src / main / java / org / opendaylight / groupbasedpolicy / renderer / vpp / commands / lisp / ConfigureNativeForwardPathCommand.java
1 /*
2  * Copyright (c) 2017 Cisco Systems. 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 package org.opendaylight.groupbasedpolicy.renderer.vpp.commands.lisp;
9
10 import org.opendaylight.groupbasedpolicy.renderer.vpp.commands.lisp.dom.NativeForwardPathDom;
11 import org.opendaylight.groupbasedpolicy.renderer.vpp.util.VppIidFactory;
12 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.gpe.rev170801._native.forward.paths.tables._native.forward.paths.table.NativeForwardPath;
13 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.gpe.rev170801._native.forward.paths.tables._native.forward.paths.table.NativeForwardPathKey;
14 import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
15
16 public class ConfigureNativeForwardPathCommand extends AbstractLispCommand<NativeForwardPath> {
17     private NativeForwardPathDom nativeForwardPathDom;
18
19     public ConfigureNativeForwardPathCommand(NativeForwardPathDom nativeForwardPathDom) {
20         this.nativeForwardPathDom = nativeForwardPathDom;
21     }
22
23     @Override
24     public InstanceIdentifier<NativeForwardPath> getIid() {
25         return VppIidFactory.getNativeForwardPathIid(nativeForwardPathDom.getVrfId(),
26                                                     new NativeForwardPathKey(nativeForwardPathDom.getNextHopIp()));
27     }
28
29     @Override
30     public NativeForwardPath getData() {
31         return nativeForwardPathDom.getSALObject();
32     }
33
34     @Override public String toString() {
35         return "Operation: " + getOperation() + ", Iid: " + this.getIid() + ", " + nativeForwardPathDom.toString();
36     }
37 }