Skip to content

Commit f15da53

Browse files
authored
Merge pull request #14 from opennetworkinglab/app-fix2
Remove srv6-related parts from app
2 parents c6ba958 + 5ed1a5d commit f15da53

13 files changed

+37
-598
lines changed

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,3 +7,5 @@ app/src/main/resources/bmv2.json
77
ptf/bmv2.log
88
ptf/ptf.log
99
ptf/ptf.pcap
10+
**/*.iml
11+
**/*.pyc

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ app-install:
113113
$(info *** Installing and activating app in ONOS...)
114114
${onos_curl} -X POST -HContent-Type:application/octet-stream \
115115
'${onos_url}/v1/applications?activate=true' \
116-
--data-binary @app/target/srv6-tutorial-1.0-SNAPSHOT.oar
116+
--data-binary @app/target/ngsdn-tutorial-1.0-SNAPSHOT.oar
117117
@echo
118118

119119
app-uninstall:

app/src/main/java/org/onosproject/ngsdn/tutorial/Ipv6RoutingComponent.java

Lines changed: 8 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@
6060
import org.osgi.service.component.annotations.Deactivate;
6161
import org.osgi.service.component.annotations.Reference;
6262
import org.osgi.service.component.annotations.ReferenceCardinality;
63-
import org.onosproject.ngsdn.tutorial.common.Srv6DeviceConfig;
63+
import org.onosproject.ngsdn.tutorial.common.FabricDeviceConfig;
6464
import org.onosproject.ngsdn.tutorial.common.Utils;
6565
import org.slf4j.Logger;
6666
import org.slf4j.LoggerFactory;
@@ -571,11 +571,6 @@ private void setUpSpineRoutes(DeviceId spineId) {
571571
final MacAddress leafMac = getMyStationMac(leafId);
572572
final Set<Ip6Prefix> subnetsToRoute = getInterfaceIpv6Prefixes(leafId);
573573

574-
// Since we're here, we also add a route for SRv6, to forward
575-
// packets with IPv6 dst the SID of a leaf switch.
576-
final Ip6Address leafSid = getDeviceSid(leafId);
577-
subnetsToRoute.add(Ip6Prefix.valueOf(leafSid, 128));
578-
579574
// Create a group with only one member.
580575
int groupId = macToGroupId(leafMac);
581576

@@ -628,24 +623,6 @@ private void setUpLeafRoutes(DeviceId leafId) {
628623
.collect(Collectors.toList());
629624

630625
insertInOrder(ecmpGroup, flowRules);
631-
632-
// Since we're here, we also add a route for SRv6, to forward
633-
// packets with IPv6 dst the SID of a spine switch, in this case using a
634-
// single-member group.
635-
stream(deviceService.getDevices())
636-
.map(Device::id)
637-
.filter(this::isSpine)
638-
.forEach(spineId -> {
639-
MacAddress spineMac = getMyStationMac(spineId);
640-
Ip6Address spineSid = getDeviceSid(spineId);
641-
int spineGroupId = macToGroupId(spineMac);
642-
GroupDescription group = createNextHopGroup(
643-
spineGroupId, Collections.singleton(spineMac), leafId);
644-
FlowRule routingRule = createRoutingRule(
645-
leafId, Ip6Prefix.valueOf(spineSid, 128),
646-
spineGroupId);
647-
insertInOrder(group, Collections.singleton(routingRule));
648-
});
649626
}
650627

651628
//--------------------------------------------------------------------------
@@ -660,7 +637,7 @@ private void setUpLeafRoutes(DeviceId leafId) {
660637
* @return true if the device is a spine, false otherwise
661638
*/
662639
private boolean isSpine(DeviceId deviceId) {
663-
return getDeviceConfig(deviceId).map(Srv6DeviceConfig::isSpine)
640+
return getDeviceConfig(deviceId).map(FabricDeviceConfig::isSpine)
664641
.orElseThrow(() -> new ItemNotFoundException(
665642
"Missing isSpine config for " + deviceId));
666643
}
@@ -684,20 +661,20 @@ private boolean isLeaf(DeviceId deviceId) {
684661
*/
685662
private MacAddress getMyStationMac(DeviceId deviceId) {
686663
return getDeviceConfig(deviceId)
687-
.map(Srv6DeviceConfig::myStationMac)
664+
.map(FabricDeviceConfig::myStationMac)
688665
.orElseThrow(() -> new ItemNotFoundException(
689666
"Missing myStationMac config for " + deviceId));
690667
}
691668

692669
/**
693-
* Returns the Srv6 config object for the given device.
670+
* Returns the fabric config object for the given device.
694671
*
695672
* @param deviceId the device ID
696-
* @return Srv6 device config
673+
* @return fabric device config
697674
*/
698-
private Optional<Srv6DeviceConfig> getDeviceConfig(DeviceId deviceId) {
699-
Srv6DeviceConfig config = networkConfigService.getConfig(
700-
deviceId, Srv6DeviceConfig.class);
675+
private Optional<FabricDeviceConfig> getDeviceConfig(DeviceId deviceId) {
676+
FabricDeviceConfig config = networkConfigService.getConfig(
677+
deviceId, FabricDeviceConfig.class);
701678
return Optional.ofNullable(config);
702679
}
703680

@@ -749,19 +726,6 @@ private void insertInOrder(GroupDescription group, Collection<FlowRule> flowRule
749726
}
750727
}
751728

752-
/**
753-
* Gets Srv6 SID for the given device.
754-
*
755-
* @param deviceId the device ID
756-
* @return SID for the device
757-
*/
758-
private Ip6Address getDeviceSid(DeviceId deviceId) {
759-
return getDeviceConfig(deviceId)
760-
.map(Srv6DeviceConfig::mySid)
761-
.orElseThrow(() -> new ItemNotFoundException(
762-
"Missing mySid config for " + deviceId));
763-
}
764-
765729
/**
766730
* Sets up IPv6 routing on all devices known by ONOS and for which this ONOS
767731
* node instance is currently master.

app/src/main/java/org/onosproject/ngsdn/tutorial/L2BridgingComponent.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@
4747
import org.osgi.service.component.annotations.Deactivate;
4848
import org.osgi.service.component.annotations.Reference;
4949
import org.osgi.service.component.annotations.ReferenceCardinality;
50-
import org.onosproject.ngsdn.tutorial.common.Srv6DeviceConfig;
50+
import org.onosproject.ngsdn.tutorial.common.FabricDeviceConfig;
5151
import org.onosproject.ngsdn.tutorial.common.Utils;
5252
import org.slf4j.Logger;
5353
import org.slf4j.LoggerFactory;
@@ -423,15 +423,15 @@ private boolean isSpine(DeviceId deviceId) {
423423
// "devices": {
424424
// "device:spine1": {
425425
// ...
426-
// "srv6DeviceConfig": {
426+
// "fabricDeviceConfig": {
427427
// "myStationMac": "...",
428428
// "mySid": "...",
429429
// "isSpine": true
430430
// }
431431
// },
432432
// ...
433-
final Srv6DeviceConfig cfg = configService.getConfig(
434-
deviceId, Srv6DeviceConfig.class);
433+
final FabricDeviceConfig cfg = configService.getConfig(
434+
deviceId, FabricDeviceConfig.class);
435435
return cfg != null && cfg.isSpine();
436436
}
437437

app/src/main/java/org/onosproject/ngsdn/tutorial/MainComponent.java

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
import org.osgi.service.component.annotations.Deactivate;
2121
import org.osgi.service.component.annotations.Reference;
2222
import org.osgi.service.component.annotations.ReferenceCardinality;
23-
import org.onosproject.ngsdn.tutorial.common.Srv6DeviceConfig;
23+
import org.onosproject.ngsdn.tutorial.common.FabricDeviceConfig;
2424
import org.onosproject.ngsdn.tutorial.pipeconf.PipeconfLoader;
2525
import org.slf4j.Logger;
2626
import org.slf4j.LoggerFactory;
@@ -36,7 +36,7 @@
3636
import static org.onosproject.ngsdn.tutorial.common.Utils.sleep;
3737

3838
/**
39-
* A component which among other things registers the Srv6DeviceConfig to the
39+
* A component which among other things registers the fabricDeviceConfig to the
4040
* netcfg subsystem.
4141
*/
4242
@Component(immediate = true, service = MainComponent.class)
@@ -68,12 +68,12 @@ public class MainComponent {
6868
@Reference(cardinality = ReferenceCardinality.MANDATORY)
6969
private ComponentConfigService compCfgService;
7070

71-
private final ConfigFactory<DeviceId, Srv6DeviceConfig> srv6ConfigFactory =
72-
new ConfigFactory<DeviceId, Srv6DeviceConfig>(
73-
SubjectFactories.DEVICE_SUBJECT_FACTORY, Srv6DeviceConfig.class, Srv6DeviceConfig.CONFIG_KEY) {
71+
private final ConfigFactory<DeviceId, FabricDeviceConfig> fabricConfigFactory =
72+
new ConfigFactory<DeviceId, FabricDeviceConfig>(
73+
SubjectFactories.DEVICE_SUBJECT_FACTORY, FabricDeviceConfig.class, FabricDeviceConfig.CONFIG_KEY) {
7474
@Override
75-
public Srv6DeviceConfig createConfig() {
76-
return new Srv6DeviceConfig();
75+
public FabricDeviceConfig createConfig() {
76+
return new FabricDeviceConfig();
7777
}
7878
};
7979

@@ -97,13 +97,13 @@ protected void activate() {
9797
compCfgService.preSetProperty("org.onosproject.provider.host.impl.HostLocationProvider",
9898
"requestIpv6ND", "true", false);
9999

100-
configRegistry.registerConfigFactory(srv6ConfigFactory);
100+
configRegistry.registerConfigFactory(fabricConfigFactory);
101101
log.info("Started");
102102
}
103103

104104
@Deactivate
105105
protected void deactivate() {
106-
configRegistry.unregisterConfigFactory(srv6ConfigFactory);
106+
configRegistry.unregisterConfigFactory(fabricConfigFactory);
107107

108108
cleanUp();
109109

app/src/main/java/org/onosproject/ngsdn/tutorial/NdpReplyComponent.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@
5050
import org.osgi.service.component.annotations.Deactivate;
5151
import org.osgi.service.component.annotations.Reference;
5252
import org.osgi.service.component.annotations.ReferenceCardinality;
53-
import org.onosproject.ngsdn.tutorial.common.Srv6DeviceConfig;
53+
import org.onosproject.ngsdn.tutorial.common.FabricDeviceConfig;
5454
import org.slf4j.Logger;
5555
import org.slf4j.LoggerFactory;
5656

@@ -122,10 +122,10 @@ private void setUpAllDevices() {
122122
}
123123

124124
private void setUpDevice(DeviceId deviceId) {
125-
Srv6DeviceConfig config = configService.getConfig(deviceId, Srv6DeviceConfig.class);
125+
FabricDeviceConfig config = configService.getConfig(deviceId, FabricDeviceConfig.class);
126126
if (config == null) {
127127
// Config not available yet
128-
throw new ItemNotFoundException("Missing Srv6Config for " + deviceId);
128+
throw new ItemNotFoundException("Missing FabricDeviceConfig for " + deviceId);
129129
}
130130

131131
final MacAddress deviceMac = config.myStationMac();

0 commit comments

Comments
 (0)