Thomas Vachuska

ONOS-2488 Finished moving network config stuff out of the incubator area.

Change-Id: I62c511938fdf8f33def99ce43f0d4417b4ba1918
Showing 32 changed files with 199 additions and 64 deletions
......@@ -32,7 +32,7 @@ import org.onlab.packet.IpPrefix;
import org.onlab.packet.MacAddress;
import org.onosproject.net.config.ConfigFactory;
import org.onosproject.net.config.NetworkConfigRegistry;
import org.onosproject.incubator.net.config.basics.SubjectFactories;
import org.onosproject.net.config.basics.SubjectFactories;
import org.onosproject.net.ConnectPoint;
import org.onosproject.net.host.HostService;
import org.onosproject.routing.config.BgpPeer;
......
......@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.onosproject.incubator.net.config.basics;
package org.onosproject.net.config.basics;
import org.onosproject.net.config.Config;
......
......@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.onosproject.incubator.net.config.basics;
package org.onosproject.net.config.basics;
import org.onosproject.net.Device;
import org.onosproject.net.DeviceId;
......
......@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.onosproject.incubator.net.config.basics;
package org.onosproject.net.config.basics;
/**
* Basic configuration for network elements, e.g. devices, hosts. Such elements
......
......@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.onosproject.incubator.net.config.basics;
package org.onosproject.net.config.basics;
import org.onosproject.net.HostId;
......
......@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.onosproject.incubator.net.config.basics;
package org.onosproject.net.config.basics;
import org.onosproject.net.Link;
import org.onosproject.net.LinkKey;
......
......@@ -13,16 +13,15 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.onosproject.incubator.net.config.basics;
package org.onosproject.net.config.basics;
import org.onosproject.core.ApplicationId;
import org.onosproject.core.CoreService;
import org.onosproject.net.config.SubjectFactory;
import org.onosproject.incubator.net.domain.IntentDomainId;
import org.onosproject.net.ConnectPoint;
import org.onosproject.net.DeviceId;
import org.onosproject.net.HostId;
import org.onosproject.net.LinkKey;
import org.onosproject.net.config.SubjectFactory;
import static com.google.common.base.Preconditions.checkArgument;
......@@ -81,14 +80,6 @@ public final class SubjectFactories {
}
};
public static final SubjectFactory<IntentDomainId> INTENT_DOMAIN_SUBJECT_FACTORY =
new SubjectFactory<IntentDomainId>(IntentDomainId.class, "domains") {
@Override
public IntentDomainId createSubject(String key) {
return IntentDomainId.valueOf(key);
}
};
/**
* Provides reference to the core service, which is required for
* application subject factory.
......
/*
* Copyright 2015 Open Networking Laboratory
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/**
* Various basic builtin network configurations.
*/
package org.onosproject.net.config.basics;
\ No newline at end of file
......@@ -60,6 +60,13 @@
<dependency>
<groupId>org.onosproject</groupId>
<artifactId>onos-core-dist</artifactId>
<version>${project.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.onosproject</groupId>
<artifactId>onos-incubator-api</artifactId>
<scope>test</scope>
<classifier>tests</classifier>
......
......@@ -13,36 +13,33 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.onosproject.incubator.net.config.impl;
package org.onosproject.net.config.impl;
import com.google.common.collect.ImmutableSet;
import org.apache.felix.scr.annotations.Activate;
import org.apache.felix.scr.annotations.Component;
import org.apache.felix.scr.annotations.Deactivate;
import org.apache.felix.scr.annotations.Reference;
import org.apache.felix.scr.annotations.ReferenceCardinality;
import org.onosproject.core.CoreService;
import org.onosproject.net.config.ConfigFactory;
import org.onosproject.net.config.NetworkConfigRegistry;
import org.onosproject.incubator.net.config.basics.BasicDeviceConfig;
import org.onosproject.incubator.net.config.basics.BasicHostConfig;
import org.onosproject.incubator.net.config.basics.BasicLinkConfig;
import org.onosproject.incubator.net.config.basics.InterfaceConfig;
import org.onosproject.incubator.net.config.basics.OpticalPortConfig;
import org.onosproject.incubator.net.config.basics.SubjectFactories;
import org.onosproject.incubator.net.domain.IntentDomainConfig;
import org.onosproject.incubator.net.domain.IntentDomainId;
import org.onosproject.net.ConnectPoint;
import org.onosproject.net.DeviceId;
import org.onosproject.net.HostId;
import org.onosproject.net.LinkKey;
import org.onosproject.net.config.ConfigFactory;
import org.onosproject.net.config.NetworkConfigRegistry;
import org.onosproject.net.config.basics.BasicDeviceConfig;
import org.onosproject.net.config.basics.BasicHostConfig;
import org.onosproject.net.config.basics.BasicLinkConfig;
import org.onosproject.net.config.basics.OpticalPortConfig;
import org.onosproject.net.config.basics.SubjectFactories;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.util.Set;
import static org.onosproject.incubator.net.config.basics.SubjectFactories.*;
import static org.onosproject.net.config.basics.SubjectFactories.*;
/**
* Component for registration of builtin basic network configurations.
......@@ -85,17 +82,9 @@ public class BasicNetworkConfigs {
return new BasicLinkConfig();
}
},
new ConfigFactory<IntentDomainId, IntentDomainConfig>(INTENT_DOMAIN_SUBJECT_FACTORY,
IntentDomainConfig.class,
"basic") {
@Override
public IntentDomainConfig createConfig() {
return new IntentDomainConfig();
}
},
new ConfigFactory<ConnectPoint, OpticalPortConfig>(CONNECT_POINT_SUBJECT_FACTORY,
OpticalPortConfig.class,
"basic") {
OpticalPortConfig.class,
"basic") {
@Override
public OpticalPortConfig createConfig() {
return new OpticalPortConfig();
......
......@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.onosproject.incubator.net.config.impl;
package org.onosproject.net.config.impl;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.node.ObjectNode;
......
......@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.onosproject.incubator.net.config.impl;
package org.onosproject.net.config.impl;
import com.fasterxml.jackson.databind.node.ObjectNode;
import com.google.common.collect.ImmutableSet;
......@@ -258,7 +258,7 @@ public class NetworkConfigManager
return new ConfigIdentifier(factory.subjectFactory().subjectKey(), factory.configKey());
}
protected static final class ConfigIdentifier {
static final class ConfigIdentifier {
final String subjectKey;
final String configKey;
......
/*
* Copyright 2015 Open Networking Laboratory
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/**
* Implementation of the network configuration subsystem.
*/
package org.onosproject.net.config.impl;
\ No newline at end of file
......@@ -18,7 +18,7 @@ package org.onosproject.net.device.impl;
import static org.slf4j.LoggerFactory.getLogger;
import org.onosproject.net.config.ConfigOperator;
import org.onosproject.incubator.net.config.basics.BasicDeviceConfig;
import org.onosproject.net.config.basics.BasicDeviceConfig;
import org.onosproject.net.AnnotationKeys;
import org.onosproject.net.DefaultAnnotations;
import org.onosproject.net.Device;
......
......@@ -31,7 +31,7 @@ import org.onosproject.core.Permission;
import org.onosproject.net.config.NetworkConfigEvent;
import org.onosproject.net.config.NetworkConfigListener;
import org.onosproject.net.config.NetworkConfigService;
import org.onosproject.incubator.net.config.basics.BasicDeviceConfig;
import org.onosproject.net.config.basics.BasicDeviceConfig;
import org.onosproject.mastership.MastershipEvent;
import org.onosproject.mastership.MastershipListener;
import org.onosproject.mastership.MastershipService;
......
......@@ -18,7 +18,7 @@ package org.onosproject.net.device.impl;
import static org.slf4j.LoggerFactory.getLogger;
import org.onosproject.net.config.ConfigOperator;
import org.onosproject.incubator.net.config.basics.OpticalPortConfig;
import org.onosproject.net.config.basics.OpticalPortConfig;
import org.onosproject.net.AnnotationKeys;
import org.onosproject.net.DefaultAnnotations;
import org.onosproject.net.PortNumber;
......
......@@ -19,7 +19,7 @@ import static org.slf4j.LoggerFactory.getLogger;
import org.slf4j.Logger;
import org.onosproject.net.config.ConfigOperator;
import org.onosproject.incubator.net.config.basics.BasicHostConfig;
import org.onosproject.net.config.basics.BasicHostConfig;
import org.onosproject.net.AnnotationKeys;
import org.onosproject.net.DefaultAnnotations;
import org.onosproject.net.SparseAnnotations;
......
......@@ -29,7 +29,7 @@ import org.onosproject.core.Permission;
import org.onosproject.net.config.NetworkConfigEvent;
import org.onosproject.net.config.NetworkConfigListener;
import org.onosproject.net.config.NetworkConfigService;
import org.onosproject.incubator.net.config.basics.BasicHostConfig;
import org.onosproject.net.config.basics.BasicHostConfig;
import org.onosproject.net.ConnectPoint;
import org.onosproject.net.DeviceId;
import org.onosproject.net.Host;
......
......@@ -21,7 +21,7 @@ import java.time.Duration;
import org.onosproject.net.AnnotationKeys;
import org.onosproject.net.config.ConfigOperator;
import org.onosproject.incubator.net.config.basics.BasicLinkConfig;
import org.onosproject.net.config.basics.BasicLinkConfig;
import org.onosproject.net.DefaultAnnotations;
import org.onosproject.net.Link;
import org.onosproject.net.SparseAnnotations;
......
......@@ -29,7 +29,7 @@ import org.onosproject.core.Permission;
import org.onosproject.net.config.NetworkConfigEvent;
import org.onosproject.net.config.NetworkConfigListener;
import org.onosproject.net.config.NetworkConfigService;
import org.onosproject.incubator.net.config.basics.BasicLinkConfig;
import org.onosproject.net.config.basics.BasicLinkConfig;
import org.onosproject.net.ConnectPoint;
import org.onosproject.net.DeviceId;
import org.onosproject.net.Link;
......
......@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.onosproject.incubator.net.config.impl;
package org.onosproject.net.config.impl;
import java.util.Set;
......@@ -27,8 +27,8 @@ import org.onosproject.net.config.ConfigFactory;
import org.onosproject.net.config.NetworkConfigRegistry;
import org.onosproject.net.config.NetworkConfigService;
import org.onosproject.net.config.SubjectFactory;
import org.onosproject.incubator.store.config.impl.DistributedNetworkConfigStore;
import org.onosproject.net.NetTestTools;
import org.onosproject.store.config.impl.DistributedNetworkConfigStore;
import org.onosproject.store.service.TestStorageService;
import static org.hamcrest.Matchers.hasSize;
......
......@@ -26,7 +26,7 @@ import org.junit.Test;
import org.onlab.packet.ChassisId;
import org.onosproject.net.config.Config;
import org.onosproject.net.config.ConfigApplyDelegate;
import org.onosproject.incubator.net.config.basics.BasicDeviceConfig;
import org.onosproject.net.config.basics.BasicDeviceConfig;
import org.onosproject.net.AnnotationKeys;
import org.onosproject.net.DefaultAnnotations;
import org.onosproject.net.DeviceId;
......
......@@ -4,7 +4,7 @@ import org.junit.Before;
import org.junit.Test;
import org.onosproject.net.config.Config;
import org.onosproject.net.config.ConfigApplyDelegate;
import org.onosproject.incubator.net.config.basics.OpticalPortConfig;
import org.onosproject.net.config.basics.OpticalPortConfig;
import org.onosproject.net.AnnotationKeys;
import org.onosproject.net.ConnectPoint;
import org.onosproject.net.DefaultAnnotations;
......
......@@ -24,7 +24,7 @@ import org.onlab.packet.MacAddress;
import org.onlab.packet.VlanId;
import org.onosproject.net.config.Config;
import org.onosproject.net.config.ConfigApplyDelegate;
import org.onosproject.incubator.net.config.basics.BasicHostConfig;
import org.onosproject.net.config.basics.BasicHostConfig;
import org.onosproject.net.AnnotationKeys;
import org.onosproject.net.DeviceId;
import org.onosproject.net.HostId;
......
......@@ -24,7 +24,7 @@ import org.junit.Before;
import org.junit.Test;
import org.onosproject.net.config.Config;
import org.onosproject.net.config.ConfigApplyDelegate;
import org.onosproject.incubator.net.config.basics.BasicLinkConfig;
import org.onosproject.net.config.basics.BasicLinkConfig;
import org.onosproject.net.AnnotationKeys;
import org.onosproject.net.ConnectPoint;
import org.onosproject.net.DefaultAnnotations;
......
......@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.onosproject.incubator.store.config.impl;
package org.onosproject.store.config.impl;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.node.ArrayNode;
......
......@@ -17,4 +17,4 @@
/**
* Implementation of the network configuration distributed store.
*/
package org.onosproject.incubator.store.config.impl;
\ No newline at end of file
package org.onosproject.store.config.impl;
\ No newline at end of file
......
......@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.onosproject.incubator.store.config.impl;
package org.onosproject.store.config.impl;
import org.junit.After;
import org.junit.Before;
......
/*
* Copyright 2015 Open Networking Laboratory
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.onosproject.incubator.net.config.basics;
import org.onosproject.incubator.net.domain.IntentDomainId;
import org.onosproject.net.config.SubjectFactory;
/**
* Set of subject factories for potential configuration subjects.
*/
public final class ExtraSubjectFactories {
// Construction forbidden
private ExtraSubjectFactories() {
}
public static final SubjectFactory<IntentDomainId> INTENT_DOMAIN_SUBJECT_FACTORY =
new SubjectFactory<IntentDomainId>(IntentDomainId.class, "domains") {
@Override
public IntentDomainId createSubject(String key) {
return IntentDomainId.valueOf(key);
}
};
}
......@@ -2,11 +2,11 @@ package org.onosproject.incubator.net.config.basics;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.onosproject.incubator.net.config.basics.OpticalPortConfig.TYPE;
import static org.onosproject.incubator.net.config.basics.OpticalPortConfig.NAME;
import static org.onosproject.incubator.net.config.basics.OpticalPortConfig.PORT;
import static org.onosproject.incubator.net.config.basics.OpticalPortConfig.STATIC_LAMBDA;
import static org.onosproject.incubator.net.config.basics.OpticalPortConfig.STATIC_PORT;
import static org.onosproject.net.config.basics.OpticalPortConfig.TYPE;
import static org.onosproject.net.config.basics.OpticalPortConfig.NAME;
import static org.onosproject.net.config.basics.OpticalPortConfig.PORT;
import static org.onosproject.net.config.basics.OpticalPortConfig.STATIC_LAMBDA;
import static org.onosproject.net.config.basics.OpticalPortConfig.STATIC_PORT;
import java.io.IOException;
import java.util.Iterator;
......@@ -26,6 +26,7 @@ import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.node.JsonNodeFactory;
import com.fasterxml.jackson.databind.node.ObjectNode;
import com.google.common.collect.Lists;
import org.onosproject.net.config.basics.OpticalPortConfig;
public class OpticalPortConfigTest {
private static final String FIELD = "ports";
......
/*
* Copyright 2015 Open Networking Laboratory
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.onosproject.incubator.net.config.impl;
import com.google.common.collect.ImmutableSet;
import org.apache.felix.scr.annotations.Activate;
import org.apache.felix.scr.annotations.Component;
import org.apache.felix.scr.annotations.Deactivate;
import org.apache.felix.scr.annotations.Reference;
import org.apache.felix.scr.annotations.ReferenceCardinality;
import org.onosproject.incubator.net.domain.IntentDomainConfig;
import org.onosproject.incubator.net.domain.IntentDomainId;
import org.onosproject.net.config.ConfigFactory;
import org.onosproject.net.config.NetworkConfigRegistry;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.util.Set;
import static org.onosproject.incubator.net.config.basics.ExtraSubjectFactories.INTENT_DOMAIN_SUBJECT_FACTORY;
/**
* Component for registration of builtin basic network configurations.
*/
@Component(immediate = true)
public class ExtraNetworkConfigs {
private final Logger log = LoggerFactory.getLogger(getClass());
private final Set<ConfigFactory> factories = ImmutableSet.of(
new ConfigFactory<IntentDomainId, IntentDomainConfig>(INTENT_DOMAIN_SUBJECT_FACTORY,
IntentDomainConfig.class,
"basic") {
@Override
public IntentDomainConfig createConfig() {
return new IntentDomainConfig();
}
}
);
@Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY)
protected NetworkConfigRegistry registry;
@Activate
public void activate() {
factories.forEach(registry::registerConfigFactory);
log.info("Started");
}
@Deactivate
public void deactivate() {
factories.forEach(registry::unregisterConfigFactory);
log.info("Stopped");
}
}