Committed by
Gerrit Code Review
[ONOS-3835] Install load balanced classifier rules
Change-Id: I585a83021dbf2aff6a65dd43944a1f6979b33ead
Showing
16 changed files
with
324 additions
and
29 deletions
| 1 | +/* | ||
| 2 | + * Copyright 2016 Open Networking Laboratory | ||
| 3 | + * | ||
| 4 | + * Licensed under the Apache License, Version 2.0 (the "License"); | ||
| 5 | + * you may not use this file except in compliance with the License. | ||
| 6 | + * You may obtain a copy of the License at | ||
| 7 | + * | ||
| 8 | + * http://www.apache.org/licenses/LICENSE-2.0 | ||
| 9 | + * | ||
| 10 | + * Unless required by applicable law or agreed to in writing, software | ||
| 11 | + * distributed under the License is distributed on an "AS IS" BASIS, | ||
| 12 | + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| 13 | + * See the License for the specific language governing permissions and | ||
| 14 | + * limitations under the License. | ||
| 15 | + */ | ||
| 1 | package org.onosproject.sfc.installer; | 16 | package org.onosproject.sfc.installer; |
| 2 | 17 | ||
| 18 | +import org.onosproject.net.ConnectPoint; | ||
| 3 | import org.onosproject.net.NshServicePathId; | 19 | import org.onosproject.net.NshServicePathId; |
| 4 | -import org.onosproject.net.flowobjective.Objective.Operation; | 20 | +import org.onosproject.vtnrsc.FiveTuple; |
| 5 | -import org.onosproject.vtnrsc.FlowClassifier; | ||
| 6 | import org.onosproject.vtnrsc.PortChain; | 21 | import org.onosproject.vtnrsc.PortChain; |
| 7 | -import org.onosproject.vtnrsc.PortPair; | ||
| 8 | 22 | ||
| 9 | /** | 23 | /** |
| 10 | * Abstraction of an entity which installs flow classification rules in ovs. | 24 | * Abstraction of an entity which installs flow classification rules in ovs. |
| ... | @@ -12,29 +26,38 @@ import org.onosproject.vtnrsc.PortPair; | ... | @@ -12,29 +26,38 @@ import org.onosproject.vtnrsc.PortPair; |
| 12 | public interface FlowClassifierInstallerService { | 26 | public interface FlowClassifierInstallerService { |
| 13 | 27 | ||
| 14 | /** | 28 | /** |
| 15 | - * Install Flow-Classifier. | 29 | + * Install flow classifier. |
| 16 | * | 30 | * |
| 17 | * @param portChain port-chain | 31 | * @param portChain port-chain |
| 18 | - * @param nshSpiId nsh spi-id | 32 | + * @param nshSpiId service path index identifier |
| 19 | */ | 33 | */ |
| 20 | - void installFlowClassifier(PortChain portChain, NshServicePathId nshSpiId); | 34 | + ConnectPoint installFlowClassifier(PortChain portChain, NshServicePathId nshSpiId); |
| 21 | 35 | ||
| 22 | /** | 36 | /** |
| 23 | - * Uninstall Flow-Classifier. | 37 | + * Uninstall flow classifier. |
| 24 | * | 38 | * |
| 25 | * @param portChain port-chain | 39 | * @param portChain port-chain |
| 26 | - * @param nshSpiId nsh spi-id | 40 | + * @param nshSpiId service path index identifier |
| 27 | */ | 41 | */ |
| 28 | - void unInstallFlowClassifier(PortChain portChain, NshServicePathId nshSpiId); | 42 | + ConnectPoint unInstallFlowClassifier(PortChain portChain, NshServicePathId nshSpiId); |
| 29 | 43 | ||
| 30 | /** | 44 | /** |
| 31 | - * Prepare forwarding object for flow classifier. | 45 | + * Install load balanced flow classifier. |
| 32 | * | 46 | * |
| 33 | - * @param flowClassifier flow classifier | 47 | + * @param portChain port-chain |
| 34 | - * @param portPair port pair | 48 | + * @param fiveTuple five tuple packet information |
| 35 | - * @param nshSpiId nsh spi id | 49 | + * @param nshSpiId service path index identifier |
| 36 | - * @param type forwarding objective operation type | 50 | + */ |
| 51 | + ConnectPoint installLoadBalancedFlowClassifier(PortChain portChain, FiveTuple fiveTuple, | ||
| 52 | + NshServicePathId nshSpiId); | ||
| 53 | + | ||
| 54 | + /** | ||
| 55 | + * Uninstall load balanced flow classifier. | ||
| 56 | + * | ||
| 57 | + * @param portChain port-chain | ||
| 58 | + * @param fiveTuple five tuple packet information | ||
| 59 | + * @param nshSpiId service path index identifier | ||
| 37 | */ | 60 | */ |
| 38 | - void prepareFlowClassification(FlowClassifier flowClassifier, PortPair portPair, NshServicePathId nshSpiId, | 61 | + ConnectPoint unInstallLoadBalancedFlowClassifier(PortChain portChain, FiveTuple fiveTuple, |
| 39 | - Operation type); | 62 | + NshServicePathId nshSpiId); |
| 40 | } | 63 | } | ... | ... |
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
| ... | @@ -28,7 +28,7 @@ import com.google.common.collect.ImmutableList; | ... | @@ -28,7 +28,7 @@ import com.google.common.collect.ImmutableList; |
| 28 | /** | 28 | /** |
| 29 | * Provides implementation of the Flow Classifier Service. | 29 | * Provides implementation of the Flow Classifier Service. |
| 30 | */ | 30 | */ |
| 31 | -public class FlowClassifierManagerTestImpl implements FlowClassifierService { | 31 | +public class FlowClassifierAdapter implements FlowClassifierService { |
| 32 | 32 | ||
| 33 | private final ConcurrentMap<FlowClassifierId, FlowClassifier> flowClassifierStore = new ConcurrentHashMap<>(); | 33 | private final ConcurrentMap<FlowClassifierId, FlowClassifier> flowClassifierStore = new ConcurrentHashMap<>(); |
| 34 | 34 | ... | ... |
| ... | @@ -16,16 +16,17 @@ | ... | @@ -16,16 +16,17 @@ |
| 16 | package org.onosproject.sfc.util; | 16 | package org.onosproject.sfc.util; |
| 17 | 17 | ||
| 18 | import org.onosproject.net.DeviceId; | 18 | import org.onosproject.net.DeviceId; |
| 19 | -import org.onosproject.net.flowobjective.FlowObjectiveService; | ||
| 20 | import org.onosproject.net.flowobjective.FilteringObjective; | 19 | import org.onosproject.net.flowobjective.FilteringObjective; |
| 20 | +import org.onosproject.net.flowobjective.FlowObjectiveService; | ||
| 21 | import org.onosproject.net.flowobjective.ForwardingObjective; | 21 | import org.onosproject.net.flowobjective.ForwardingObjective; |
| 22 | import org.onosproject.net.flowobjective.NextObjective; | 22 | import org.onosproject.net.flowobjective.NextObjective; |
| 23 | 23 | ||
| 24 | /** | 24 | /** |
| 25 | * Testing version of implementation on FlowObjectiveService. | 25 | * Testing version of implementation on FlowObjectiveService. |
| 26 | */ | 26 | */ |
| 27 | -public class FlowObjectiveServiceTestImpl implements FlowObjectiveService { | 27 | +public class FlowObjectiveAdapter implements FlowObjectiveService { |
| 28 | 28 | ||
| 29 | + private ForwardingObjective forwardingObjective; | ||
| 29 | @Override | 30 | @Override |
| 30 | public void filter(DeviceId deviceId, FilteringObjective filteringObjective) { | 31 | public void filter(DeviceId deviceId, FilteringObjective filteringObjective) { |
| 31 | 32 | ||
| ... | @@ -33,7 +34,7 @@ public class FlowObjectiveServiceTestImpl implements FlowObjectiveService { | ... | @@ -33,7 +34,7 @@ public class FlowObjectiveServiceTestImpl implements FlowObjectiveService { |
| 33 | 34 | ||
| 34 | @Override | 35 | @Override |
| 35 | public void forward(DeviceId deviceId, ForwardingObjective forwardingObjective) { | 36 | public void forward(DeviceId deviceId, ForwardingObjective forwardingObjective) { |
| 36 | - | 37 | + this.forwardingObjective = forwardingObjective; |
| 37 | } | 38 | } |
| 38 | 39 | ||
| 39 | @Override | 40 | @Override |
| ... | @@ -50,4 +51,8 @@ public class FlowObjectiveServiceTestImpl implements FlowObjectiveService { | ... | @@ -50,4 +51,8 @@ public class FlowObjectiveServiceTestImpl implements FlowObjectiveService { |
| 50 | public void initPolicy(String policy) { | 51 | public void initPolicy(String policy) { |
| 51 | 52 | ||
| 52 | } | 53 | } |
| 54 | + | ||
| 55 | + public ForwardingObjective forwardingObjective() { | ||
| 56 | + return forwardingObjective; | ||
| 57 | + } | ||
| 53 | } | 58 | } | ... | ... |
| 1 | +/* | ||
| 2 | + * Copyright 2016 Open Networking Laboratory | ||
| 3 | + * | ||
| 4 | + * Licensed under the Apache License, Version 2.0 (the "License"); | ||
| 5 | + * you may not use this file except in compliance with the License. | ||
| 6 | + * You may obtain a copy of the License at | ||
| 7 | + * | ||
| 8 | + * http://www.apache.org/licenses/LICENSE-2.0 | ||
| 9 | + * | ||
| 10 | + * Unless required by applicable law or agreed to in writing, software | ||
| 11 | + * distributed under the License is distributed on an "AS IS" BASIS, | ||
| 12 | + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| 13 | + * See the License for the specific language governing permissions and | ||
| 14 | + * limitations under the License. | ||
| 15 | + */ | ||
| 16 | + | ||
| 17 | +package org.onosproject.sfc.util; | ||
| 18 | + | ||
| 19 | +import org.onosproject.net.behaviour.ExtensionSelectorResolver; | ||
| 20 | +import org.onosproject.net.behaviour.ExtensionTreatmentResolver; | ||
| 21 | +import org.onosproject.net.driver.Behaviour; | ||
| 22 | +import org.onosproject.net.driver.Driver; | ||
| 23 | +import org.onosproject.net.driver.DriverData; | ||
| 24 | +import org.onosproject.net.driver.DriverHandler; | ||
| 25 | + | ||
| 26 | +public class MockDriverHandler implements DriverHandler { | ||
| 27 | + | ||
| 28 | + @Override | ||
| 29 | + public Driver driver() { | ||
| 30 | + return null; | ||
| 31 | + } | ||
| 32 | + | ||
| 33 | + @Override | ||
| 34 | + public DriverData data() { | ||
| 35 | + return null; | ||
| 36 | + } | ||
| 37 | + | ||
| 38 | + @Override | ||
| 39 | + public <T extends Behaviour> T behaviour(Class<T> behaviourClass) { | ||
| 40 | + if (behaviourClass == ExtensionSelectorResolver.class) { | ||
| 41 | + return (T) new MockExtensionSelectorResolver(); | ||
| 42 | + } else if (behaviourClass == ExtensionTreatmentResolver.class) { | ||
| 43 | + return (T) new MockExtensionTreatmentResolver(); | ||
| 44 | + } | ||
| 45 | + return null; | ||
| 46 | + } | ||
| 47 | + | ||
| 48 | + @Override | ||
| 49 | + public <T> T get(Class<T> serviceClass) { | ||
| 50 | + return null; | ||
| 51 | + } | ||
| 52 | +} | ||
| ... | \ No newline at end of file | ... | \ No newline at end of file |
| 1 | +/* | ||
| 2 | + * Copyright 2016 Open Networking Laboratory | ||
| 3 | + * | ||
| 4 | + * Licensed under the Apache License, Version 2.0 (the "License"); | ||
| 5 | + * you may not use this file except in compliance with the License. | ||
| 6 | + * You may obtain a copy of the License at | ||
| 7 | + * | ||
| 8 | + * http://www.apache.org/licenses/LICENSE-2.0 | ||
| 9 | + * | ||
| 10 | + * Unless required by applicable law or agreed to in writing, software | ||
| 11 | + * distributed under the License is distributed on an "AS IS" BASIS, | ||
| 12 | + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| 13 | + * See the License for the specific language governing permissions and | ||
| 14 | + * limitations under the License. | ||
| 15 | + */ | ||
| 16 | +package org.onosproject.sfc.util; | ||
| 17 | + | ||
| 18 | +import java.util.List; | ||
| 19 | + | ||
| 20 | +import org.onosproject.net.flow.criteria.ExtensionSelector; | ||
| 21 | +import org.onosproject.net.flow.criteria.ExtensionSelectorType; | ||
| 22 | +import org.onosproject.net.flow.instructions.ExtensionPropertyException; | ||
| 23 | + | ||
| 24 | +public class MockExtensionSelector implements ExtensionSelector { | ||
| 25 | + | ||
| 26 | + @Override | ||
| 27 | + public <T> void setPropertyValue(String key, T value) throws ExtensionPropertyException { | ||
| 28 | + } | ||
| 29 | + | ||
| 30 | + @Override | ||
| 31 | + public <T> T getPropertyValue(String key) throws ExtensionPropertyException { | ||
| 32 | + return null; | ||
| 33 | + } | ||
| 34 | + | ||
| 35 | + @Override | ||
| 36 | + public List<String> getProperties() { | ||
| 37 | + return null; | ||
| 38 | + } | ||
| 39 | + | ||
| 40 | + @Override | ||
| 41 | + public byte[] serialize() { | ||
| 42 | + return null; | ||
| 43 | + } | ||
| 44 | + | ||
| 45 | + @Override | ||
| 46 | + public void deserialize(byte[] data) { | ||
| 47 | + } | ||
| 48 | + | ||
| 49 | + @Override | ||
| 50 | + public ExtensionSelectorType type() { | ||
| 51 | + return null; | ||
| 52 | + } | ||
| 53 | +} | ||
| ... | \ No newline at end of file | ... | \ No newline at end of file |
apps/vtn/sfcmgr/src/test/java/org/onosproject/sfc/util/MockExtensionSelectorResolver.java
0 → 100644
| 1 | +/* | ||
| 2 | + * Copyright 2016 Open Networking Laboratory | ||
| 3 | + * | ||
| 4 | + * Licensed under the Apache License, Version 2.0 (the "License"); | ||
| 5 | + * you may not use this file except in compliance with the License. | ||
| 6 | + * You may obtain a copy of the License at | ||
| 7 | + * | ||
| 8 | + * http://www.apache.org/licenses/LICENSE-2.0 | ||
| 9 | + * | ||
| 10 | + * Unless required by applicable law or agreed to in writing, software | ||
| 11 | + * distributed under the License is distributed on an "AS IS" BASIS, | ||
| 12 | + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| 13 | + * See the License for the specific language governing permissions and | ||
| 14 | + * limitations under the License. | ||
| 15 | + */ | ||
| 16 | +package org.onosproject.sfc.util; | ||
| 17 | + | ||
| 18 | +import org.onosproject.net.behaviour.ExtensionSelectorResolver; | ||
| 19 | +import org.onosproject.net.driver.DriverData; | ||
| 20 | +import org.onosproject.net.driver.DriverHandler; | ||
| 21 | +import org.onosproject.net.flow.criteria.ExtensionSelector; | ||
| 22 | +import org.onosproject.net.flow.criteria.ExtensionSelectorType; | ||
| 23 | + | ||
| 24 | +public class MockExtensionSelectorResolver implements ExtensionSelectorResolver { | ||
| 25 | + | ||
| 26 | + @Override | ||
| 27 | + public DriverHandler handler() { | ||
| 28 | + return null; | ||
| 29 | + } | ||
| 30 | + | ||
| 31 | + @Override | ||
| 32 | + public void setHandler(DriverHandler handler) { | ||
| 33 | + } | ||
| 34 | + | ||
| 35 | + @Override | ||
| 36 | + public DriverData data() { | ||
| 37 | + return null; | ||
| 38 | + } | ||
| 39 | + | ||
| 40 | + @Override | ||
| 41 | + public void setData(DriverData data) { | ||
| 42 | + } | ||
| 43 | + | ||
| 44 | + @Override | ||
| 45 | + public ExtensionSelector getExtensionSelector(ExtensionSelectorType type) { | ||
| 46 | + return new MockExtensionSelector(); | ||
| 47 | + } | ||
| 48 | +} | ||
| ... | \ No newline at end of file | ... | \ No newline at end of file |
| 1 | +/* | ||
| 2 | + * Copyright 2016 Open Networking Laboratory | ||
| 3 | + * | ||
| 4 | + * Licensed under the Apache License, Version 2.0 (the "License"); | ||
| 5 | + * you may not use this file except in compliance with the License. | ||
| 6 | + * You may obtain a copy of the License at | ||
| 7 | + * | ||
| 8 | + * http://www.apache.org/licenses/LICENSE-2.0 | ||
| 9 | + * | ||
| 10 | + * Unless required by applicable law or agreed to in writing, software | ||
| 11 | + * distributed under the License is distributed on an "AS IS" BASIS, | ||
| 12 | + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| 13 | + * See the License for the specific language governing permissions and | ||
| 14 | + * limitations under the License. | ||
| 15 | + */ | ||
| 16 | +package org.onosproject.sfc.util; | ||
| 17 | + | ||
| 18 | +import java.util.List; | ||
| 19 | + | ||
| 20 | +import org.onosproject.net.flow.instructions.ExtensionPropertyException; | ||
| 21 | +import org.onosproject.net.flow.instructions.ExtensionTreatment; | ||
| 22 | +import org.onosproject.net.flow.instructions.ExtensionTreatmentType; | ||
| 23 | + | ||
| 24 | +public class MockExtensionTreatment implements ExtensionTreatment { | ||
| 25 | + | ||
| 26 | + @Override | ||
| 27 | + public <T> void setPropertyValue(String key, T value) throws ExtensionPropertyException { | ||
| 28 | + } | ||
| 29 | + | ||
| 30 | + @Override | ||
| 31 | + public <T> T getPropertyValue(String key) throws ExtensionPropertyException { | ||
| 32 | + return null; | ||
| 33 | + } | ||
| 34 | + | ||
| 35 | + @Override | ||
| 36 | + public List<String> getProperties() { | ||
| 37 | + return null; | ||
| 38 | + } | ||
| 39 | + | ||
| 40 | + @Override | ||
| 41 | + public byte[] serialize() { | ||
| 42 | + return null; | ||
| 43 | + } | ||
| 44 | + | ||
| 45 | + @Override | ||
| 46 | + public void deserialize(byte[] data) { | ||
| 47 | + } | ||
| 48 | + | ||
| 49 | + @Override | ||
| 50 | + public ExtensionTreatmentType type() { | ||
| 51 | + return null; | ||
| 52 | + } | ||
| 53 | + | ||
| 54 | +} | ||
| ... | \ No newline at end of file | ... | \ No newline at end of file |
apps/vtn/sfcmgr/src/test/java/org/onosproject/sfc/util/MockExtensionTreatmentResolver.java
0 → 100644
| 1 | +/* | ||
| 2 | + * Copyright 2016 Open Networking Laboratory | ||
| 3 | + * | ||
| 4 | + * Licensed under the Apache License, Version 2.0 (the "License"); | ||
| 5 | + * you may not use this file except in compliance with the License. | ||
| 6 | + * You may obtain a copy of the License at | ||
| 7 | + * | ||
| 8 | + * http://www.apache.org/licenses/LICENSE-2.0 | ||
| 9 | + * | ||
| 10 | + * Unless required by applicable law or agreed to in writing, software | ||
| 11 | + * distributed under the License is distributed on an "AS IS" BASIS, | ||
| 12 | + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| 13 | + * See the License for the specific language governing permissions and | ||
| 14 | + * limitations under the License. | ||
| 15 | + */ | ||
| 16 | +package org.onosproject.sfc.util; | ||
| 17 | + | ||
| 18 | +import org.onosproject.net.behaviour.ExtensionTreatmentResolver; | ||
| 19 | +import org.onosproject.net.driver.DriverData; | ||
| 20 | +import org.onosproject.net.driver.DriverHandler; | ||
| 21 | +import org.onosproject.net.flow.instructions.ExtensionTreatment; | ||
| 22 | +import org.onosproject.net.flow.instructions.ExtensionTreatmentType; | ||
| 23 | + | ||
| 24 | +public class MockExtensionTreatmentResolver implements ExtensionTreatmentResolver { | ||
| 25 | + | ||
| 26 | + @Override | ||
| 27 | + public DriverHandler handler() { | ||
| 28 | + return null; | ||
| 29 | + } | ||
| 30 | + | ||
| 31 | + @Override | ||
| 32 | + public void setHandler(DriverHandler handler) { | ||
| 33 | + } | ||
| 34 | + | ||
| 35 | + @Override | ||
| 36 | + public DriverData data() { | ||
| 37 | + return null; | ||
| 38 | + } | ||
| 39 | + | ||
| 40 | + @Override | ||
| 41 | + public void setData(DriverData data) { | ||
| 42 | + } | ||
| 43 | + | ||
| 44 | + @Override | ||
| 45 | + public ExtensionTreatment getExtensionInstruction(ExtensionTreatmentType type) { | ||
| 46 | + return new MockExtensionTreatment(); | ||
| 47 | + } | ||
| 48 | + | ||
| 49 | +} | ||
| ... | \ No newline at end of file | ... | \ No newline at end of file |
| ... | @@ -29,7 +29,7 @@ import org.onosproject.event.AbstractListenerManager; | ... | @@ -29,7 +29,7 @@ import org.onosproject.event.AbstractListenerManager; |
| 29 | /** | 29 | /** |
| 30 | * Provides implementation of the portChainService. | 30 | * Provides implementation of the portChainService. |
| 31 | */ | 31 | */ |
| 32 | -public class PortChainManagerTestImpl | 32 | +public class PortChainAdapter |
| 33 | extends AbstractListenerManager<PortChainEvent, PortChainListener> | 33 | extends AbstractListenerManager<PortChainEvent, PortChainListener> |
| 34 | implements PortChainService { | 34 | implements PortChainService { |
| 35 | 35 | ... | ... |
| ... | @@ -27,7 +27,7 @@ import org.onosproject.vtnrsc.portpair.PortPairService; | ... | @@ -27,7 +27,7 @@ import org.onosproject.vtnrsc.portpair.PortPairService; |
| 27 | /** | 27 | /** |
| 28 | * Provides implementation of the portPairService. | 28 | * Provides implementation of the portPairService. |
| 29 | */ | 29 | */ |
| 30 | -public class PortPairManagerTestImpl implements PortPairService { | 30 | +public class PortPairAdapter implements PortPairService { |
| 31 | 31 | ||
| 32 | private ConcurrentMap<PortPairId, PortPair> portPairStore = new ConcurrentHashMap<>(); | 32 | private ConcurrentMap<PortPairId, PortPair> portPairStore = new ConcurrentHashMap<>(); |
| 33 | 33 | ... | ... |
| ... | @@ -27,7 +27,7 @@ import org.onosproject.vtnrsc.portpairgroup.PortPairGroupService; | ... | @@ -27,7 +27,7 @@ import org.onosproject.vtnrsc.portpairgroup.PortPairGroupService; |
| 27 | /** | 27 | /** |
| 28 | * Provides implementation of the portPairGroupService. | 28 | * Provides implementation of the portPairGroupService. |
| 29 | */ | 29 | */ |
| 30 | -public class PortPairGroupManagerTestImpl implements PortPairGroupService { | 30 | +public class PortPairGroupAdapter implements PortPairGroupService { |
| 31 | 31 | ||
| 32 | private ConcurrentMap<PortPairGroupId, PortPairGroup> portPairGroupStore = new ConcurrentHashMap<>(); | 32 | private ConcurrentMap<PortPairGroupId, PortPairGroup> portPairGroupStore = new ConcurrentHashMap<>(); |
| 33 | 33 | ... | ... |
| ... | @@ -31,7 +31,7 @@ import org.onosproject.vtnrsc.virtualport.VirtualPortService; | ... | @@ -31,7 +31,7 @@ import org.onosproject.vtnrsc.virtualport.VirtualPortService; |
| 31 | /** | 31 | /** |
| 32 | * Provides implementation of the VirtualPort APIs. | 32 | * Provides implementation of the VirtualPort APIs. |
| 33 | */ | 33 | */ |
| 34 | -public class VirtualPortManagerTestImpl implements VirtualPortService { | 34 | +public class VirtualPortAdapter implements VirtualPortService { |
| 35 | 35 | ||
| 36 | protected ConcurrentMap<VirtualPortId, VirtualPort> vPortStore = new ConcurrentHashMap<>(); | 36 | protected ConcurrentMap<VirtualPortId, VirtualPort> vPortStore = new ConcurrentHashMap<>(); |
| 37 | 37 | ... | ... |
| ... | @@ -31,7 +31,7 @@ import org.onosproject.vtnrsc.service.VtnRscService; | ... | @@ -31,7 +31,7 @@ import org.onosproject.vtnrsc.service.VtnRscService; |
| 31 | /** | 31 | /** |
| 32 | * Provides implementation of the VtnRsc service. | 32 | * Provides implementation of the VtnRsc service. |
| 33 | */ | 33 | */ |
| 34 | -public class VtnRscManagerTestImpl implements VtnRscService { | 34 | +public class VtnRscAdapter implements VtnRscService { |
| 35 | @Override | 35 | @Override |
| 36 | public void addListener(VtnRscListener listener) { | 36 | public void addListener(VtnRscListener listener) { |
| 37 | } | 37 | } |
| ... | @@ -62,13 +62,12 @@ public class VtnRscManagerTestImpl implements VtnRscService { | ... | @@ -62,13 +62,12 @@ public class VtnRscManagerTestImpl implements VtnRscService { |
| 62 | 62 | ||
| 63 | @Override | 63 | @Override |
| 64 | public boolean isServiceFunction(VirtualPortId portId) { | 64 | public boolean isServiceFunction(VirtualPortId portId) { |
| 65 | - // TODO Auto-generated method stub | ||
| 66 | return false; | 65 | return false; |
| 67 | } | 66 | } |
| 68 | 67 | ||
| 69 | @Override | 68 | @Override |
| 70 | public DeviceId getSfToSffMaping(VirtualPortId portId) { | 69 | public DeviceId getSfToSffMaping(VirtualPortId portId) { |
| 71 | - return DeviceId.deviceId("www.google.com"); | 70 | + return DeviceId.deviceId("of:000000000000001"); |
| 72 | } | 71 | } |
| 73 | 72 | ||
| 74 | @Override | 73 | @Override | ... | ... |
| ... | @@ -15,15 +15,21 @@ | ... | @@ -15,15 +15,21 @@ |
| 15 | */ | 15 | */ |
| 16 | package org.onosproject.net.host; | 16 | package org.onosproject.net.host; |
| 17 | 17 | ||
| 18 | +import java.util.Set; | ||
| 19 | + | ||
| 18 | import org.onlab.packet.IpAddress; | 20 | import org.onlab.packet.IpAddress; |
| 19 | import org.onlab.packet.MacAddress; | 21 | import org.onlab.packet.MacAddress; |
| 20 | import org.onlab.packet.VlanId; | 22 | import org.onlab.packet.VlanId; |
| 23 | +import org.onosproject.net.Annotations; | ||
| 21 | import org.onosproject.net.ConnectPoint; | 24 | import org.onosproject.net.ConnectPoint; |
| 25 | +import org.onosproject.net.DefaultHost; | ||
| 22 | import org.onosproject.net.DeviceId; | 26 | import org.onosproject.net.DeviceId; |
| 23 | import org.onosproject.net.Host; | 27 | import org.onosproject.net.Host; |
| 24 | import org.onosproject.net.HostId; | 28 | import org.onosproject.net.HostId; |
| 29 | +import org.onosproject.net.HostLocation; | ||
| 30 | +import org.onosproject.net.provider.ProviderId; | ||
| 25 | 31 | ||
| 26 | -import java.util.Set; | 32 | +import com.google.common.collect.Sets; |
| 27 | 33 | ||
| 28 | /** | 34 | /** |
| 29 | * Test adapter for host service. | 35 | * Test adapter for host service. |
| ... | @@ -41,7 +47,13 @@ public class HostServiceAdapter implements HostService { | ... | @@ -41,7 +47,13 @@ public class HostServiceAdapter implements HostService { |
| 41 | 47 | ||
| 42 | @Override | 48 | @Override |
| 43 | public Host getHost(HostId hostId) { | 49 | public Host getHost(HostId hostId) { |
| 44 | - return null; | 50 | + ProviderId providerId = ProviderId.NONE; |
| 51 | + MacAddress mac = MacAddress.valueOf("fa:12:3e:56:ee:a2"); | ||
| 52 | + VlanId vlan = VlanId.NONE; | ||
| 53 | + HostLocation location = HostLocation.NONE; | ||
| 54 | + Set<IpAddress> ips = Sets.newHashSet(); | ||
| 55 | + Annotations annotations = null; | ||
| 56 | + return new DefaultHost(providerId, hostId, mac, vlan, location, ips, annotations); | ||
| 45 | } | 57 | } |
| 46 | 58 | ||
| 47 | @Override | 59 | @Override | ... | ... |
-
Please register or login to post a comment