From 08b8d361a8966b0fc70e55b3f15aa92da6809b19 Mon Sep 17 00:00:00 2001 From: kwanggithub <kwang@clemson.edu> Date: Fri, 5 Oct 2012 14:55:44 -0700 Subject: [PATCH] Creating RoutingDecision as only class implementing IRoputingDecision; updating all exisitng dependencies --- .../routing/RoutingDecision.java | 97 +++++++++++++++++++ 1 file changed, 97 insertions(+) create mode 100644 src/main/java/net/floodlightcontroller/routing/RoutingDecision.java diff --git a/src/main/java/net/floodlightcontroller/routing/RoutingDecision.java b/src/main/java/net/floodlightcontroller/routing/RoutingDecision.java new file mode 100644 index 000000000..5b32b2332 --- /dev/null +++ b/src/main/java/net/floodlightcontroller/routing/RoutingDecision.java @@ -0,0 +1,97 @@ +package net.floodlightcontroller.routing; + +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; + +import net.floodlightcontroller.core.FloodlightContext; +import net.floodlightcontroller.devicemanager.IDevice; +import net.floodlightcontroller.devicemanager.SwitchPort; + + +public class RoutingDecision implements IRoutingDecision { + + protected RoutingAction action; + protected Integer wildcards; + protected SwitchPort srcPort; + protected IDevice srcDevice; + protected List<IDevice> destDevices; + protected List<SwitchPort> broadcastIntertfaces; + + public RoutingDecision(long swDipd, + short inPort, + IDevice srcDevice, + RoutingAction action) { + this.srcPort = new SwitchPort(swDipd, inPort); + this.srcDevice = srcDevice; + this.destDevices = + Collections.synchronizedList(new ArrayList<IDevice>()); + this.broadcastIntertfaces = + Collections.synchronizedList(new ArrayList<SwitchPort>()); + this.action = action; + this.wildcards = null; + } + + @Override + public RoutingAction getRoutingAction() { + return this.action; + } + + @Override + public void setRoutingAction(RoutingAction action) { + this.action = action; + } + + @Override + public SwitchPort getSourcePort() { + return this.srcPort; + } + + @Override + public IDevice getSourceDevice() { + return this.srcDevice; + } + + @Override + public List<IDevice> getDestinationDevices() { + return this.destDevices; + } + + @Override + public void addDestinationDevice(IDevice d) { + if (!destDevices.contains(d)) { + destDevices.add(d); + } + } + + @Override + public void setMulticastInterfaces(List<SwitchPort> lspt) { + this.broadcastIntertfaces = lspt; + } + + @Override + public List<SwitchPort> getMulticastInterfaces() { + return this.broadcastIntertfaces; + } + + @Override + public Integer getWildcards() { + return this.wildcards; + } + + @Override + public void setWildcards(Integer wildcards) { + this.wildcards = wildcards; + } + + @Override + public void addToContext(FloodlightContext cntx) { + rtStore.put(cntx, IRoutingDecision.CONTEXT_DECISION, this); + } + + public String toString() { + return "action " + action + + " wildcard " + + ((wildcards == null) ? null : "0x"+Integer.toHexString(wildcards.intValue())); + } +} -- GitLab