2 * Copyright (c) 2016 Ericsson India Global Services Pvt Ltd. 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.netvirt.elan.arp.responder;
10 import com.google.common.base.Strings;
12 import java.math.BigInteger;
13 import java.util.Collections;
14 import java.util.List;
16 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction.list.Instruction;
18 public class ArpResponderInput {
20 private BigInteger dpId;
21 private String interfaceName;
25 private List<Instruction> instructions;
28 private ArpResponderInput() {}
30 public BigInteger getDpId() {
34 public String getInterfaceName() {
38 public String getSpa() {
42 public String getSha() {
46 public int getLportTag() {
50 public List<Instruction> getInstructions() {
51 if (instructions == null) {
52 instructions = Collections.emptyList();
57 public static class ArpReponderInputBuilder {
59 private ArpResponderInput input;
61 public ArpReponderInputBuilder() {
62 input = new ArpResponderInput();
65 public ArpResponderInput build() {
69 public ArpResponderInput buildForInstallFlow() {
71 if (input.dpId == null || Strings.isNullOrEmpty(input.interfaceName) || Strings.isNullOrEmpty(input.spa)
72 || Strings.isNullOrEmpty(input.sha) || input.lportTag == 0 || input.instructions.isEmpty()) {
73 throw new AssertionError("Missing mandatory fields for ARP Responder Install Flow");
79 public ArpResponderInput buildForRemoveFlow() {
81 if (input.dpId == null || Strings.isNullOrEmpty(input.interfaceName) || Strings.isNullOrEmpty(input.spa)
82 || input.lportTag == 0) {
83 throw new AssertionError("Missing mandatory fields for ARP Responder Install Flow");
89 public ArpReponderInputBuilder(ArpResponderInput input) {
94 public ArpReponderInputBuilder setDpId(BigInteger dpId) {
99 public ArpReponderInputBuilder setInterfaceName(String interfaceName) {
100 input.interfaceName = interfaceName;
104 public ArpReponderInputBuilder setSpa(String spa) {
109 public ArpReponderInputBuilder setSha(String sha) {
114 public ArpReponderInputBuilder setLportTag(int lportTag) {
115 input.lportTag = lportTag;
119 public ArpReponderInputBuilder setInstructions(List<Instruction> instructions) {
120 input.instructions = instructions == null ? Collections.emptyList() : instructions;