diff options
author | CNlucius <lukai1@huawei.com> | 2016-09-13 11:40:12 +0800 |
---|---|---|
committer | CNlucius <lukai1@huawei.com> | 2016-09-13 11:41:53 +0800 |
commit | b731e2f1dd0972409b136aebc7b463dd72c9cfad (patch) | |
tree | 5107d7d80c19ad8076c2c97c2b5ef8d1cf3ab903 /framework/src/onos/tools/package | |
parent | ee93993458266114c29271a481ef9ce7ce621b2a (diff) |
ONOSFW-171
O/S-SFC-ONOS scenario documentation
Change-Id: I51ae1cf736ea24ab6680f8edca1b2bf5dd598365
Signed-off-by: CNlucius <lukai1@huawei.com>
Diffstat (limited to 'framework/src/onos/tools/package')
111 files changed, 0 insertions, 5820 deletions
diff --git a/framework/src/onos/tools/package/README b/framework/src/onos/tools/package/README deleted file mode 100644 index 3a2e4ff0..00000000 --- a/framework/src/onos/tools/package/README +++ /dev/null @@ -1 +0,0 @@ -Artifacts for packaging onos.tar.gz. diff --git a/framework/src/onos/tools/package/archetypes/api/pom.xml b/framework/src/onos/tools/package/archetypes/api/pom.xml deleted file mode 100644 index 0ad9b69b..00000000 --- a/framework/src/onos/tools/package/archetypes/api/pom.xml +++ /dev/null @@ -1,31 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!-- - ~ Copyright 2014 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. - --> -<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> - <modelVersion>4.0.0</modelVersion> - - <parent> - <groupId>org.onosproject</groupId> - <artifactId>onos-archetypes</artifactId> - <version>1.4.0-rc1</version> - </parent> - - <artifactId>onos-api-archetype</artifactId> - <packaging>maven-archetype</packaging> - - <description>ONOS OSGi API bundle archetype</description> - -</project> diff --git a/framework/src/onos/tools/package/archetypes/api/src/main/resources/META-INF/maven/archetype-metadata.xml b/framework/src/onos/tools/package/archetypes/api/src/main/resources/META-INF/maven/archetype-metadata.xml deleted file mode 100644 index e35285e6..00000000 --- a/framework/src/onos/tools/package/archetypes/api/src/main/resources/META-INF/maven/archetype-metadata.xml +++ /dev/null @@ -1,30 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!-- - ~ Copyright 2014 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. - --> -<archetype-descriptor - xsi:schemaLocation="http://maven.apache.org/plugins/maven-archetype-plugin/archetype-descriptor/1.0.0 http://maven.apache.org/xsd/archetype-descriptor-1.0.0.xsd" - name="onos-bundle" - xmlns="http://maven.apache.org/plugins/maven-archetype-plugin/archetype-descriptor/1.0.0" - xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> - <fileSets> - <fileSet filtered="true" packaged="true" encoding="UTF-8"> - <directory>src/main/java</directory> - <includes> - <include>**/*.java</include> - </includes> - </fileSet> - </fileSets> -</archetype-descriptor> diff --git a/framework/src/onos/tools/package/archetypes/api/src/main/resources/archetype-resources/pom.xml b/framework/src/onos/tools/package/archetypes/api/src/main/resources/archetype-resources/pom.xml deleted file mode 100644 index 89a4f464..00000000 --- a/framework/src/onos/tools/package/archetypes/api/src/main/resources/archetype-resources/pom.xml +++ /dev/null @@ -1,60 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!-- - ~ Copyright 2014 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. - --> -<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> - <modelVersion>4.0.0</modelVersion> - - <groupId>${groupId}</groupId> - <artifactId>${artifactId}</artifactId> - <version>${version}</version> - <packaging>bundle</packaging> - - <description>ONOS OSGi API bundle archetype</description> - <url>http://onosproject.org</url> - - <properties> - <onos.version>1.4.0-rc1</onos.version> - </properties> - - <dependencies> - <dependency> - <groupId>org.onosproject</groupId> - <artifactId>onos-api</artifactId> - <version>${onos.version}</version> - </dependency> - </dependencies> - - <build> - <plugins> - <plugin> - <groupId>org.apache.felix</groupId> - <artifactId>maven-bundle-plugin</artifactId> - <version>2.5.3</version> - <extensions>true</extensions> - </plugin> - <plugin> - <groupId>org.apache.maven.plugins</groupId> - <artifactId>maven-compiler-plugin</artifactId> - <version>2.5.1</version> - <configuration> - <source>1.8</source> - <target>1.8</target> - </configuration> - </plugin> - </plugins> - </build> - -</project> diff --git a/framework/src/onos/tools/package/archetypes/api/src/main/resources/archetype-resources/src/main/java/AppService.java b/framework/src/onos/tools/package/archetypes/api/src/main/resources/archetype-resources/src/main/java/AppService.java deleted file mode 100644 index 4878f2ba..00000000 --- a/framework/src/onos/tools/package/archetypes/api/src/main/resources/archetype-resources/src/main/java/AppService.java +++ /dev/null @@ -1,26 +0,0 @@ -#set( $symbol_pound = '#' ) -#set( $symbol_dollar = '$' ) -#set( $symbol_escape = '\' ) -/* - * Copyright 2014 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 ${package}; - -/** - * Skeletal ONOS application API. - */ -public interface AppService { - -} diff --git a/framework/src/onos/tools/package/archetypes/api/src/test/resources/projects/basic/archetype.properties b/framework/src/onos/tools/package/archetypes/api/src/test/resources/projects/basic/archetype.properties deleted file mode 100644 index a1213b40..00000000 --- a/framework/src/onos/tools/package/archetypes/api/src/test/resources/projects/basic/archetype.properties +++ /dev/null @@ -1,21 +0,0 @@ -# -# Copyright 2014 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. -# - -#Thu Dec 04 09:24:50 PST 2014 -package=it.pkg -version=0.1-SNAPSHOT -groupId=archetype.it -artifactId=basic diff --git a/framework/src/onos/tools/package/archetypes/api/src/test/resources/projects/basic/goal.txt b/framework/src/onos/tools/package/archetypes/api/src/test/resources/projects/basic/goal.txt deleted file mode 100644 index e69de29b..00000000 --- a/framework/src/onos/tools/package/archetypes/api/src/test/resources/projects/basic/goal.txt +++ /dev/null diff --git a/framework/src/onos/tools/package/archetypes/bundle/pom.xml b/framework/src/onos/tools/package/archetypes/bundle/pom.xml deleted file mode 100644 index 0709acd5..00000000 --- a/framework/src/onos/tools/package/archetypes/bundle/pom.xml +++ /dev/null @@ -1,31 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!-- - ~ Copyright 2014 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. - --> -<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> - <modelVersion>4.0.0</modelVersion> - - <parent> - <groupId>org.onosproject</groupId> - <artifactId>onos-archetypes</artifactId> - <version>1.4.0-rc1</version> - </parent> - - <artifactId>onos-bundle-archetype</artifactId> - <packaging>maven-archetype</packaging> - - <description>ONOS OSGi bundle archetype</description> - -</project> diff --git a/framework/src/onos/tools/package/archetypes/bundle/src/main/resources/META-INF/maven/archetype-metadata.xml b/framework/src/onos/tools/package/archetypes/bundle/src/main/resources/META-INF/maven/archetype-metadata.xml deleted file mode 100644 index ef60bd05..00000000 --- a/framework/src/onos/tools/package/archetypes/bundle/src/main/resources/META-INF/maven/archetype-metadata.xml +++ /dev/null @@ -1,36 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!-- - ~ Copyright 2014 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. - --> -<archetype-descriptor - xsi:schemaLocation="http://maven.apache.org/plugins/maven-archetype-plugin/archetype-descriptor/1.0.0 http://maven.apache.org/xsd/archetype-descriptor-1.0.0.xsd" - name="onos-bundle" - xmlns="http://maven.apache.org/plugins/maven-archetype-plugin/archetype-descriptor/1.0.0" - xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> - <fileSets> - <fileSet filtered="true" packaged="true" encoding="UTF-8"> - <directory>src/main/java</directory> - <includes> - <include>**/*.java</include> - </includes> - </fileSet> - <fileSet filtered="true" packaged="true" encoding="UTF-8"> - <directory>src/test/java</directory> - <includes> - <include>**/*.java</include> - </includes> - </fileSet> - </fileSets> -</archetype-descriptor> diff --git a/framework/src/onos/tools/package/archetypes/bundle/src/main/resources/archetype-resources/pom.xml b/framework/src/onos/tools/package/archetypes/bundle/src/main/resources/archetype-resources/pom.xml deleted file mode 100644 index bf0f7ea1..00000000 --- a/framework/src/onos/tools/package/archetypes/bundle/src/main/resources/archetype-resources/pom.xml +++ /dev/null @@ -1,139 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!-- - ~ Copyright 2014 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. - --> -<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> - <modelVersion>4.0.0</modelVersion> - - <groupId>${groupId}</groupId> - <artifactId>${artifactId}</artifactId> - <version>${version}</version> - <packaging>bundle</packaging> - - <description>ONOS OSGi bundle archetype</description> - <url>http://onosproject.org</url> - - <properties> - <onos.version>1.4.0-rc1</onos.version> - <!-- Uncomment to generate ONOS app from this module. - <onos.app.name>org.foo.app</onos.app.name> - <onos.app.origin>Foo, Inc.</onos.app.origin> - --> - </properties> - - <dependencies> - <dependency> - <groupId>org.onosproject</groupId> - <artifactId>onos-api</artifactId> - <version>${onos.version}</version> - </dependency> - - <dependency> - <groupId>org.onosproject</groupId> - <artifactId>onlab-osgi</artifactId> - <version>${onos.version}</version> - </dependency> - - <dependency> - <groupId>junit</groupId> - <artifactId>junit</artifactId> - <version>4.11</version> - <scope>test</scope> - </dependency> - - <dependency> - <groupId>org.onosproject</groupId> - <artifactId>onos-api</artifactId> - <version>${onos.version}</version> - <scope>test</scope> - <classifier>tests</classifier> - </dependency> - - <dependency> - <groupId>org.apache.felix</groupId> - <artifactId>org.apache.felix.scr.annotations</artifactId> - <version>1.9.8</version> - <scope>provided</scope> - </dependency> - </dependencies> - - <build> - <plugins> - <plugin> - <groupId>org.apache.felix</groupId> - <artifactId>maven-bundle-plugin</artifactId> - <version>2.5.3</version> - <extensions>true</extensions> - </plugin> - <plugin> - <groupId>org.apache.maven.plugins</groupId> - <artifactId>maven-compiler-plugin</artifactId> - <version>2.5.1</version> - <configuration> - <source>1.8</source> - <target>1.8</target> - </configuration> - </plugin> - <plugin> - <groupId>org.apache.felix</groupId> - <artifactId>maven-scr-plugin</artifactId> - <version>1.20.0</version> - <executions> - <execution> - <id>generate-scr-srcdescriptor</id> - <goals> - <goal>scr</goal> - </goals> - </execution> - </executions> - <configuration> - <supportedProjectTypes> - <supportedProjectType>bundle</supportedProjectType> - <supportedProjectType>war</supportedProjectType> - </supportedProjectTypes> - </configuration> - </plugin> - <plugin> - <groupId>org.onosproject</groupId> - <artifactId>onos-maven-plugin</artifactId> - <version>1.5</version> - <executions> - <execution> - <id>cfg</id> - <phase>generate-resources</phase> - <goals> - <goal>cfg</goal> - </goals> - </execution> - <execution> - <id>swagger</id> - <phase>generate-sources</phase> - <goals> - <goal>swagger</goal> - </goals> - </execution> - <execution> - <id>app</id> - <phase>package</phase> - <goals> - <goal>app</goal> - </goals> - </execution> - </executions> - </plugin> - </plugins> - </build> - -</project> diff --git a/framework/src/onos/tools/package/archetypes/bundle/src/main/resources/archetype-resources/src/main/java/AppComponent.java b/framework/src/onos/tools/package/archetypes/bundle/src/main/resources/archetype-resources/src/main/java/AppComponent.java deleted file mode 100644 index 693b6fd4..00000000 --- a/framework/src/onos/tools/package/archetypes/bundle/src/main/resources/archetype-resources/src/main/java/AppComponent.java +++ /dev/null @@ -1,46 +0,0 @@ -#set( $symbol_pound = '#' ) -#set( $symbol_dollar = '$' ) -#set( $symbol_escape = '\' ) -/* - * Copyright 2014 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 ${package}; - -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.Service; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -/** - * Skeletal ONOS application component. - */ -@Component(immediate = true) -public class AppComponent { - - private final Logger log = LoggerFactory.getLogger(getClass()); - - @Activate - protected void activate() { - log.info("Started"); - } - - @Deactivate - protected void deactivate() { - log.info("Stopped"); - } - -} diff --git a/framework/src/onos/tools/package/archetypes/bundle/src/main/resources/archetype-resources/src/test/java/AppComponentTest.java b/framework/src/onos/tools/package/archetypes/bundle/src/main/resources/archetype-resources/src/test/java/AppComponentTest.java deleted file mode 100644 index b981225d..00000000 --- a/framework/src/onos/tools/package/archetypes/bundle/src/main/resources/archetype-resources/src/test/java/AppComponentTest.java +++ /dev/null @@ -1,49 +0,0 @@ -#set( $symbol_pound = '#' ) -#set( $symbol_dollar = '$' ) -#set( $symbol_escape = '\' ) -/* - * Copyright 2014 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 ${package}; - -import org.junit.After; -import org.junit.Before; -import org.junit.Test; - -/** - * Set of tests of the ONOS application component. - */ -public class AppComponentTest { - - private AppComponent component; - - @Before - public void setUp() { - component = new AppComponent(); - component.activate(); - - } - - @After - public void tearDown() { - component.deactivate(); - } - - @Test - public void basics() { - - } - -} diff --git a/framework/src/onos/tools/package/archetypes/bundle/src/test/resources/projects/basic/archetype.properties b/framework/src/onos/tools/package/archetypes/bundle/src/test/resources/projects/basic/archetype.properties deleted file mode 100644 index a1213b40..00000000 --- a/framework/src/onos/tools/package/archetypes/bundle/src/test/resources/projects/basic/archetype.properties +++ /dev/null @@ -1,21 +0,0 @@ -# -# Copyright 2014 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. -# - -#Thu Dec 04 09:24:50 PST 2014 -package=it.pkg -version=0.1-SNAPSHOT -groupId=archetype.it -artifactId=basic diff --git a/framework/src/onos/tools/package/archetypes/bundle/src/test/resources/projects/basic/goal.txt b/framework/src/onos/tools/package/archetypes/bundle/src/test/resources/projects/basic/goal.txt deleted file mode 100644 index e69de29b..00000000 --- a/framework/src/onos/tools/package/archetypes/bundle/src/test/resources/projects/basic/goal.txt +++ /dev/null diff --git a/framework/src/onos/tools/package/archetypes/cli/pom.xml b/framework/src/onos/tools/package/archetypes/cli/pom.xml deleted file mode 100644 index b57a3138..00000000 --- a/framework/src/onos/tools/package/archetypes/cli/pom.xml +++ /dev/null @@ -1,32 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!-- - ~ Copyright 2014 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. - --> -<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> - <modelVersion>4.0.0</modelVersion> - - <parent> - <groupId>org.onosproject</groupId> - <artifactId>onos-archetypes</artifactId> - <version>1.4.0-rc1</version> - </parent> - - <artifactId>onos-cli-archetype</artifactId> - <packaging>maven-archetype</packaging> - - <name>onos-cli-archetype</name> - <description>ONOS Apache Karaf bundle archetype</description> - -</project> diff --git a/framework/src/onos/tools/package/archetypes/cli/src/main/resources/META-INF/maven/archetype-metadata.xml b/framework/src/onos/tools/package/archetypes/cli/src/main/resources/META-INF/maven/archetype-metadata.xml deleted file mode 100644 index 8558d476..00000000 --- a/framework/src/onos/tools/package/archetypes/cli/src/main/resources/META-INF/maven/archetype-metadata.xml +++ /dev/null @@ -1,36 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!-- - ~ Copyright 2014 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. - --> -<archetype-descriptor - xsi:schemaLocation="http://maven.apache.org/plugins/maven-archetype-plugin/archetype-descriptor/1.0.0 http://maven.apache.org/xsd/archetype-descriptor-1.0.0.xsd" - name="onos-cli" partial="true" - xmlns="http://maven.apache.org/plugins/maven-archetype-plugin/archetype-descriptor/1.0.0" - xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> - <fileSets> - <fileSet filtered="true" packaged="true" encoding="UTF-8"> - <directory>src/main/java</directory> - <includes> - <include>**/*.java</include> - </includes> - </fileSet> - <fileSet filtered="true" packaged="false" encoding="UTF-8"> - <directory>src/main/resources</directory> - <includes> - <include>**/*.xml</include> - </includes> - </fileSet> - </fileSets> -</archetype-descriptor> diff --git a/framework/src/onos/tools/package/archetypes/cli/src/main/resources/archetype-resources/pom.xml b/framework/src/onos/tools/package/archetypes/cli/src/main/resources/archetype-resources/pom.xml deleted file mode 100644 index b344cc59..00000000 --- a/framework/src/onos/tools/package/archetypes/cli/src/main/resources/archetype-resources/pom.xml +++ /dev/null @@ -1,126 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!-- - ~ Copyright 2014 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. - --> -<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> - <modelVersion>4.0.0</modelVersion> - - <groupId>${groupId}</groupId> - <artifactId>${artifactId}</artifactId> - <version>${version}</version> - <packaging>bundle</packaging> - - <description>ONOS OSGi bundle archetype</description> - <url>http://onosproject.org</url> - - <properties> - <onos.version>1.4.0-rc1</onos.version> - </properties> - - <dependencies> - <dependency> - <groupId>org.onosproject</groupId> - <artifactId>onos-api</artifactId> - <version>${onos.version}</version> - </dependency> - - <dependency> - <groupId>org.onosproject</groupId> - <artifactId>onlab-osgi</artifactId> - <version>${onos.version}</version> - </dependency> - - <dependency> - <groupId>junit</groupId> - <artifactId>junit</artifactId> - <version>4.11</version> - <scope>test</scope> - </dependency> - - <dependency> - <groupId>org.onosproject</groupId> - <artifactId>onos-cli</artifactId> - <version>${onos.version}</version> - <scope>provided</scope> - </dependency> - - <dependency> - <groupId>org.onosproject</groupId> - <artifactId>onos-api</artifactId> - <version>${onos.version}</version> - <scope>test</scope> - <classifier>tests</classifier> - </dependency> - - <dependency> - <groupId>org.osgi</groupId> - <artifactId>org.osgi.core</artifactId> - <version>4.3.1</version> - <scope>provided</scope> - </dependency> - <dependency> - <groupId>org.apache.felix</groupId> - <artifactId>org.apache.felix.scr.annotations</artifactId> - <version>1.9.8</version> - <scope>provided</scope> - </dependency> - <dependency> - <groupId>org.apache.karaf.shell</groupId> - <artifactId>org.apache.karaf.shell.console</artifactId> - <version>3.0.3</version> - <scope>provided</scope> - </dependency> - </dependencies> - - <build> - <plugins> - <plugin> - <groupId>org.apache.felix</groupId> - <artifactId>maven-bundle-plugin</artifactId> - <version>2.5.3</version> - <extensions>true</extensions> - </plugin> - <plugin> - <groupId>org.apache.maven.plugins</groupId> - <artifactId>maven-compiler-plugin</artifactId> - <version>2.5.1</version> - <configuration> - <source>1.8</source> - <target>1.8</target> - </configuration> - </plugin> - <plugin> - <groupId>org.apache.felix</groupId> - <artifactId>maven-scr-plugin</artifactId> - <version>1.20.0</version> - <executions> - <execution> - <id>generate-scr-srcdescriptor</id> - <goals> - <goal>scr</goal> - </goals> - </execution> - </executions> - <configuration> - <supportedProjectTypes> - <supportedProjectType>bundle</supportedProjectType> - <supportedProjectType>war</supportedProjectType> - </supportedProjectTypes> - </configuration> - </plugin> - </plugins> - </build> - -</project> diff --git a/framework/src/onos/tools/package/archetypes/cli/src/main/resources/archetype-resources/src/main/java/AppCommand.java b/framework/src/onos/tools/package/archetypes/cli/src/main/resources/archetype-resources/src/main/java/AppCommand.java deleted file mode 100644 index 9262b2e4..00000000 --- a/framework/src/onos/tools/package/archetypes/cli/src/main/resources/archetype-resources/src/main/java/AppCommand.java +++ /dev/null @@ -1,33 +0,0 @@ -/* - * Copyright 2014 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 ${package}; - -import org.apache.karaf.shell.commands.Command; -import org.onosproject.cli.AbstractShellCommand; - -/** - * Sample Apache Karaf CLI command - */ -@Command(scope = "onos", name = "sample", - description = "Sample Apache Karaf CLI command") -public class AppCommand extends AbstractShellCommand { - - @Override - protected void execute() { - print("Hello %s", "World"); - } - -} diff --git a/framework/src/onos/tools/package/archetypes/cli/src/main/resources/archetype-resources/src/main/resources/OSGI-INF/blueprint/shell-config.xml b/framework/src/onos/tools/package/archetypes/cli/src/main/resources/archetype-resources/src/main/resources/OSGI-INF/blueprint/shell-config.xml deleted file mode 100644 index 202ab9ed..00000000 --- a/framework/src/onos/tools/package/archetypes/cli/src/main/resources/archetype-resources/src/main/resources/OSGI-INF/blueprint/shell-config.xml +++ /dev/null @@ -1,24 +0,0 @@ -<!-- - ~ Copyright 2014 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. - --> -<blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0"> - - <command-bundle xmlns="http://karaf.apache.org/xmlns/shell/v1.1.0"> - <command> - <action class="${package}.AppCommand"/> - </command> - </command-bundle> - -</blueprint> diff --git a/framework/src/onos/tools/package/archetypes/cli/src/test/resources/projects/basic/archetype.properties b/framework/src/onos/tools/package/archetypes/cli/src/test/resources/projects/basic/archetype.properties deleted file mode 100644 index a1213b40..00000000 --- a/framework/src/onos/tools/package/archetypes/cli/src/test/resources/projects/basic/archetype.properties +++ /dev/null @@ -1,21 +0,0 @@ -# -# Copyright 2014 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. -# - -#Thu Dec 04 09:24:50 PST 2014 -package=it.pkg -version=0.1-SNAPSHOT -groupId=archetype.it -artifactId=basic diff --git a/framework/src/onos/tools/package/archetypes/cli/src/test/resources/projects/basic/goal.txt b/framework/src/onos/tools/package/archetypes/cli/src/test/resources/projects/basic/goal.txt deleted file mode 100644 index e69de29b..00000000 --- a/framework/src/onos/tools/package/archetypes/cli/src/test/resources/projects/basic/goal.txt +++ /dev/null diff --git a/framework/src/onos/tools/package/archetypes/pom.xml b/framework/src/onos/tools/package/archetypes/pom.xml deleted file mode 100644 index 8a0be1f5..00000000 --- a/framework/src/onos/tools/package/archetypes/pom.xml +++ /dev/null @@ -1,64 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!-- - ~ Copyright 2014 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. - --> -<project xmlns="http://maven.apache.org/POM/4.0.0" - xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> - <modelVersion>4.0.0</modelVersion> - - <parent> - <groupId>org.onosproject</groupId> - <artifactId>onos-base</artifactId> - <version>1</version> - <relativePath>../../build/pom.xml</relativePath> - </parent> - - <groupId>org.onosproject</groupId> - <artifactId>onos-archetypes</artifactId> - <version>1.4.0-rc1</version> - <packaging>pom</packaging> - - <description>ONOS archetypes project</description> - - <modules> - <module>api</module> - <module>bundle</module> - <module>cli</module> - <module>ui</module> - <module>uitab</module> - <module>uitopo</module> - </modules> - - <build> - <extensions> - <extension> - <groupId>org.apache.maven.archetype</groupId> - <artifactId>archetype-packaging</artifactId> - <version>2.2</version> - </extension> - </extensions> - - <pluginManagement> - <plugins> - <plugin> - <artifactId>maven-archetype-plugin</artifactId> - <version>2.2</version> - </plugin> - </plugins> - </pluginManagement> - </build> - -</project> diff --git a/framework/src/onos/tools/package/archetypes/ui/pom.xml b/framework/src/onos/tools/package/archetypes/ui/pom.xml deleted file mode 100644 index c4ed2c01..00000000 --- a/framework/src/onos/tools/package/archetypes/ui/pom.xml +++ /dev/null @@ -1,31 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!-- - ~ 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. - --> -<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> - <modelVersion>4.0.0</modelVersion> - - <parent> - <groupId>org.onosproject</groupId> - <artifactId>onos-archetypes</artifactId> - <version>1.4.0-rc1</version> - </parent> - - <artifactId>onos-ui-archetype</artifactId> - <packaging>maven-archetype</packaging> - - <description>ONOS UI Custom-View overlay archetype</description> - -</project> diff --git a/framework/src/onos/tools/package/archetypes/ui/src/main/resources/META-INF/maven/archetype-metadata.xml b/framework/src/onos/tools/package/archetypes/ui/src/main/resources/META-INF/maven/archetype-metadata.xml deleted file mode 100644 index 309fd6ad..00000000 --- a/framework/src/onos/tools/package/archetypes/ui/src/main/resources/META-INF/maven/archetype-metadata.xml +++ /dev/null @@ -1,38 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!-- - ~ 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. - --> -<archetype-descriptor - xsi:schemaLocation="http://maven.apache.org/plugins/maven-archetype-plugin/archetype-descriptor/1.0.0 http://maven.apache.org/xsd/archetype-descriptor-1.0.0.xsd" - name="onos-ui" partial="true" - xmlns="http://maven.apache.org/plugins/maven-archetype-plugin/archetype-descriptor/1.0.0" - xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> - <fileSets> - <fileSet filtered="true" packaged="true" encoding="UTF-8"> - <directory>src/main/java</directory> - <includes> - <include>**/*.java</include> - </includes> - </fileSet> - <fileSet filtered="true" packaged="false" encoding="UTF-8"> - <directory>src/main/resources</directory> - <includes> - <include>**/*.html</include> - <include>**/*.js</include> - <include>**/*.css</include> - </includes> - </fileSet> - </fileSets> -</archetype-descriptor> diff --git a/framework/src/onos/tools/package/archetypes/ui/src/main/resources/archetype-resources/pom.xml b/framework/src/onos/tools/package/archetypes/ui/src/main/resources/archetype-resources/pom.xml deleted file mode 100644 index c067ee51..00000000 --- a/framework/src/onos/tools/package/archetypes/ui/src/main/resources/archetype-resources/pom.xml +++ /dev/null @@ -1,139 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!-- - ~ 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. - --> -<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> - <modelVersion>4.0.0</modelVersion> - - <groupId>${groupId}</groupId> - <artifactId>${artifactId}</artifactId> - <version>${version}</version> - <packaging>bundle</packaging> - - <description>ONOS OSGi UI Custom-View bundle archetype</description> - <url>http://onosproject.org</url> - - <properties> - <onos.version>1.4.0-rc1</onos.version> - <!-- Uncomment to generate ONOS app from this module. - <onos.app.name>org.foo.app</onos.app.name> - <onos.app.origin>Foo, Inc.</onos.app.origin> - --> - </properties> - - <dependencies> - <dependency> - <groupId>org.onosproject</groupId> - <artifactId>onos-api</artifactId> - <version>${onos.version}</version> - </dependency> - - <dependency> - <groupId>org.onosproject</groupId> - <artifactId>onlab-osgi</artifactId> - <version>${onos.version}</version> - </dependency> - - <dependency> - <groupId>junit</groupId> - <artifactId>junit</artifactId> - <version>4.11</version> - <scope>test</scope> - </dependency> - - <dependency> - <groupId>org.onosproject</groupId> - <artifactId>onos-api</artifactId> - <version>${onos.version}</version> - <scope>test</scope> - <classifier>tests</classifier> - </dependency> - - <dependency> - <groupId>org.apache.felix</groupId> - <artifactId>org.apache.felix.scr.annotations</artifactId> - <version>1.9.8</version> - <scope>provided</scope> - </dependency> - </dependencies> - - <build> - <plugins> - <plugin> - <groupId>org.apache.felix</groupId> - <artifactId>maven-bundle-plugin</artifactId> - <version>2.5.3</version> - <extensions>true</extensions> - </plugin> - <plugin> - <groupId>org.apache.maven.plugins</groupId> - <artifactId>maven-compiler-plugin</artifactId> - <version>2.5.1</version> - <configuration> - <source>1.8</source> - <target>1.8</target> - </configuration> - </plugin> - <plugin> - <groupId>org.apache.felix</groupId> - <artifactId>maven-scr-plugin</artifactId> - <version>1.20.0</version> - <executions> - <execution> - <id>generate-scr-srcdescriptor</id> - <goals> - <goal>scr</goal> - </goals> - </execution> - </executions> - <configuration> - <supportedProjectTypes> - <supportedProjectType>bundle</supportedProjectType> - <supportedProjectType>war</supportedProjectType> - </supportedProjectTypes> - </configuration> - </plugin> - <plugin> - <groupId>org.onosproject</groupId> - <artifactId>onos-maven-plugin</artifactId> - <version>1.5</version> - <executions> - <execution> - <id>cfg</id> - <phase>generate-resources</phase> - <goals> - <goal>cfg</goal> - </goals> - </execution> - <execution> - <id>swagger</id> - <phase>generate-sources</phase> - <goals> - <goal>swagger</goal> - </goals> - </execution> - <execution> - <id>app</id> - <phase>package</phase> - <goals> - <goal>app</goal> - </goals> - </execution> - </executions> - </plugin> - </plugins> - </build> - -</project> diff --git a/framework/src/onos/tools/package/archetypes/ui/src/main/resources/archetype-resources/src/main/java/AppUiComponent.java b/framework/src/onos/tools/package/archetypes/ui/src/main/resources/archetype-resources/src/main/java/AppUiComponent.java deleted file mode 100644 index e44b34d5..00000000 --- a/framework/src/onos/tools/package/archetypes/ui/src/main/resources/archetype-resources/src/main/java/AppUiComponent.java +++ /dev/null @@ -1,79 +0,0 @@ -#set( $symbol_pound = '#' ) -#set( $symbol_dollar = '$' ) -#set( $symbol_escape = '\' ) -/* - * Copyright 2014,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 ${package}; - -import com.google.common.collect.ImmutableList; -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.ui.UiExtension; -import org.onosproject.ui.UiExtensionService; -import org.onosproject.ui.UiMessageHandlerFactory; -import org.onosproject.ui.UiView; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import java.util.List; - -/** - * Skeletal ONOS UI Custom-View application component. - */ -@Component(immediate = true) -public class AppUiComponent { - - private static final String VIEW_ID = "sampleCustom"; - private static final String VIEW_TEXT = "Sample Custom"; - - private final Logger log = LoggerFactory.getLogger(getClass()); - - @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY) - protected UiExtensionService uiExtensionService; - - // List of application views - private final List<UiView> uiViews = ImmutableList.of( - new UiView(UiView.Category.OTHER, VIEW_ID, VIEW_TEXT) - ); - - // Factory for UI message handlers - private final UiMessageHandlerFactory messageHandlerFactory = - () -> ImmutableList.of( - new AppUiMessageHandler() - ); - - // Application UI extension - protected UiExtension extension = - new UiExtension.Builder(getClass().getClassLoader(), uiViews) - .messageHandlerFactory(messageHandlerFactory) - .build(); - - @Activate - protected void activate() { - uiExtensionService.register(extension); - log.info("Started"); - } - - @Deactivate - protected void deactivate() { - uiExtensionService.unregister(extension); - log.info("Stopped"); - } - -} diff --git a/framework/src/onos/tools/package/archetypes/ui/src/main/resources/archetype-resources/src/main/java/AppUiMessageHandler.java b/framework/src/onos/tools/package/archetypes/ui/src/main/resources/archetype-resources/src/main/java/AppUiMessageHandler.java deleted file mode 100644 index d6486328..00000000 --- a/framework/src/onos/tools/package/archetypes/ui/src/main/resources/archetype-resources/src/main/java/AppUiMessageHandler.java +++ /dev/null @@ -1,77 +0,0 @@ -#set( $symbol_pound = '#' ) -#set( $symbol_dollar = '$' ) -#set( $symbol_escape = '\' ) -/* - * Copyright 2014,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 ${package}; - -import com.fasterxml.jackson.databind.node.ObjectNode; -import com.google.common.collect.ImmutableSet; -import org.onosproject.ui.RequestHandler; -import org.onosproject.ui.UiMessageHandler; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import java.util.Collection; - -/** - * Skeletal ONOS UI Custom-View message handler. - */ -public class AppUiMessageHandler extends UiMessageHandler { - - private static final String SAMPLE_CUSTOM_DATA_REQ = "sampleCustomDataRequest"; - private static final String SAMPLE_CUSTOM_DATA_RESP = "sampleCustomDataResponse"; - - private static final String NUMBER = "number"; - private static final String SQUARE = "square"; - private static final String CUBE = "cube"; - private static final String MESSAGE = "message"; - private static final String MSG_FORMAT = "Next incrememt is %d units"; - - private final Logger log = LoggerFactory.getLogger(getClass()); - - private long someNumber = 1; - private long someIncrement = 1; - - @Override - protected Collection<RequestHandler> createRequestHandlers() { - return ImmutableSet.of( - new SampleCustomDataRequestHandler() - ); - } - - // handler for sample data requests - private final class SampleCustomDataRequestHandler extends RequestHandler { - - private SampleCustomDataRequestHandler() { - super(SAMPLE_CUSTOM_DATA_REQ); - } - - @Override - public void process(long sid, ObjectNode payload) { - someIncrement++; - someNumber += someIncrement; - log.debug("Computing data for {}...", someNumber); - - ObjectNode result = objectNode(); - result.put(NUMBER, someNumber); - result.put(SQUARE, someNumber * someNumber); - result.put(CUBE, someNumber * someNumber * someNumber); - result.put(MESSAGE, String.format(MSG_FORMAT, someIncrement + 1)); - sendMessage(SAMPLE_CUSTOM_DATA_RESP, 0, result); - } - } -}
\ No newline at end of file diff --git a/framework/src/onos/tools/package/archetypes/ui/src/main/resources/archetype-resources/src/main/resources/app/view/sampleCustom/sampleCustom.css b/framework/src/onos/tools/package/archetypes/ui/src/main/resources/archetype-resources/src/main/resources/app/view/sampleCustom/sampleCustom.css deleted file mode 100644 index ffeac0aa..00000000 --- a/framework/src/onos/tools/package/archetypes/ui/src/main/resources/archetype-resources/src/main/resources/app/view/sampleCustom/sampleCustom.css +++ /dev/null @@ -1,48 +0,0 @@ -/* css for sample app custom view */ - -#ov-sample-custom { - padding: 20px; -} -.light #ov-sample-custom { - color: navy; -} -.dark #ov-sample-custom { - color: #88f; -} - -#ov-sample-custom .button-panel { - margin: 10px; - width: 200px; -} - -.light #ov-sample-custom .button-panel { - background-color: #ccf; -} -.dark #ov-sample-custom .button-panel { - background-color: #444; -} - -#ov-sample-custom .my-button { - cursor: pointer; - padding: 4px; - text-align: center; -} - -.light #ov-sample-custom .my-button { - color: white; - background-color: #99d; -} -.dark #ov-sample-custom .my-button { - color: black; - background-color: #aaa; -} - -#ov-sample-custom .number { - font-size: 140%; - text-align: right; -} - -#ov-sample-custom .quote { - margin: 10px 20px; - font-style: italic; -}
\ No newline at end of file diff --git a/framework/src/onos/tools/package/archetypes/ui/src/main/resources/archetype-resources/src/main/resources/app/view/sampleCustom/sampleCustom.html b/framework/src/onos/tools/package/archetypes/ui/src/main/resources/archetype-resources/src/main/resources/app/view/sampleCustom/sampleCustom.html deleted file mode 100644 index d3d79a10..00000000 --- a/framework/src/onos/tools/package/archetypes/ui/src/main/resources/archetype-resources/src/main/resources/app/view/sampleCustom/sampleCustom.html +++ /dev/null @@ -1,32 +0,0 @@ -<!-- partial HTML --> -<div id="ov-sample-custom"> - <div class="button-panel"> - <div class="my-button" ng-click="getData()"> - Fetch Data - </div> - </div> - - <div class="data-panel"> - <table> - <tr> - <td> Number </td> - <td class="number"> {{data.number}} </td> - </tr> - <tr> - <td> Square </td> - <td class="number"> {{data.square}} </td> - </tr> - <tr> - <td> Cube </td> - <td class="number"> {{data.cube}} </td> - </tr> - </table> - - <p> - A message from our sponsors: - </p> - <p> - <span class="quote"> {{data.message}} </span> - </p> - </div> -</div> diff --git a/framework/src/onos/tools/package/archetypes/ui/src/main/resources/archetype-resources/src/main/resources/app/view/sampleCustom/sampleCustom.js b/framework/src/onos/tools/package/archetypes/ui/src/main/resources/archetype-resources/src/main/resources/app/view/sampleCustom/sampleCustom.js deleted file mode 100644 index 21058640..00000000 --- a/framework/src/onos/tools/package/archetypes/ui/src/main/resources/archetype-resources/src/main/resources/app/view/sampleCustom/sampleCustom.js +++ /dev/null @@ -1,69 +0,0 @@ -// js for sample app custom view -(function () { - 'use strict'; - - // injected refs - var $log, $scope, wss, ks; - - // constants - var dataReq = 'sampleCustomDataRequest', - dataResp = 'sampleCustomDataResponse'; - - function addKeyBindings() { - var map = { - space: [getData, 'Fetch data from server'], - - _helpFormat: [ - ['space'] - ] - }; - - ks.keyBindings(map); - } - - function getData() { - wss.sendEvent(dataReq); - } - - function respDataCb(data) { - $scope.data = data; - $scope.$apply(); - } - - - angular.module('ovSampleCustom', []) - .controller('OvSampleCustomCtrl', - ['$log', '$scope', 'WebSocketService', 'KeyService', - - function (_$log_, _$scope_, _wss_, _ks_) { - $log = _$log_; - $scope = _$scope_; - wss = _wss_; - ks = _ks_; - - var handlers = {}; - $scope.data = {}; - - // data response handler - handlers[dataResp] = respDataCb; - wss.bindHandlers(handlers); - - addKeyBindings(); - - // custom click handler - $scope.getData = getData; - - // get data the first time... - getData(); - - // cleanup - $scope.$on('$destroy', function () { - wss.unbindHandlers(handlers); - ks.unbindKeys(); - $log.log('OvSampleCustomCtrl has been destroyed'); - }); - - $log.log('OvSampleCustomCtrl has been created'); - }]); - -}()); diff --git a/framework/src/onos/tools/package/archetypes/ui/src/main/resources/archetype-resources/src/main/resources/css.html b/framework/src/onos/tools/package/archetypes/ui/src/main/resources/archetype-resources/src/main/resources/css.html deleted file mode 100644 index 4e7b7092..00000000 --- a/framework/src/onos/tools/package/archetypes/ui/src/main/resources/archetype-resources/src/main/resources/css.html +++ /dev/null @@ -1 +0,0 @@ -<link rel="stylesheet" href="app/view/sampleCustom/sampleCustom.css">
\ No newline at end of file diff --git a/framework/src/onos/tools/package/archetypes/ui/src/main/resources/archetype-resources/src/main/resources/js.html b/framework/src/onos/tools/package/archetypes/ui/src/main/resources/archetype-resources/src/main/resources/js.html deleted file mode 100644 index 6550b85e..00000000 --- a/framework/src/onos/tools/package/archetypes/ui/src/main/resources/archetype-resources/src/main/resources/js.html +++ /dev/null @@ -1 +0,0 @@ -<script src="app/view/sampleCustom/sampleCustom.js"></script>
\ No newline at end of file diff --git a/framework/src/onos/tools/package/archetypes/ui/src/test/resources/projects/basic/archetype.properties b/framework/src/onos/tools/package/archetypes/ui/src/test/resources/projects/basic/archetype.properties deleted file mode 100644 index a1213b40..00000000 --- a/framework/src/onos/tools/package/archetypes/ui/src/test/resources/projects/basic/archetype.properties +++ /dev/null @@ -1,21 +0,0 @@ -# -# Copyright 2014 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. -# - -#Thu Dec 04 09:24:50 PST 2014 -package=it.pkg -version=0.1-SNAPSHOT -groupId=archetype.it -artifactId=basic diff --git a/framework/src/onos/tools/package/archetypes/ui/src/test/resources/projects/basic/goal.txt b/framework/src/onos/tools/package/archetypes/ui/src/test/resources/projects/basic/goal.txt deleted file mode 100644 index e69de29b..00000000 --- a/framework/src/onos/tools/package/archetypes/ui/src/test/resources/projects/basic/goal.txt +++ /dev/null diff --git a/framework/src/onos/tools/package/archetypes/uitab/pom.xml b/framework/src/onos/tools/package/archetypes/uitab/pom.xml deleted file mode 100644 index e82c96ff..00000000 --- a/framework/src/onos/tools/package/archetypes/uitab/pom.xml +++ /dev/null @@ -1,31 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!-- - ~ 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. - --> -<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> - <modelVersion>4.0.0</modelVersion> - - <parent> - <groupId>org.onosproject</groupId> - <artifactId>onos-archetypes</artifactId> - <version>1.4.0-rc1</version> - </parent> - - <artifactId>onos-uitab-archetype</artifactId> - <packaging>maven-archetype</packaging> - - <description>ONOS UI Table-View overlay archetype</description> - -</project> diff --git a/framework/src/onos/tools/package/archetypes/uitab/src/main/resources/META-INF/maven/archetype-metadata.xml b/framework/src/onos/tools/package/archetypes/uitab/src/main/resources/META-INF/maven/archetype-metadata.xml deleted file mode 100644 index a6273811..00000000 --- a/framework/src/onos/tools/package/archetypes/uitab/src/main/resources/META-INF/maven/archetype-metadata.xml +++ /dev/null @@ -1,39 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> - -<!-- - ~ 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. - --> -<archetype-descriptor - xsi:schemaLocation="http://maven.apache.org/plugins/maven-archetype-plugin/archetype-descriptor/1.0.0 http://maven.apache.org/xsd/archetype-descriptor-1.0.0.xsd" - name="onos-uitab" partial="true" - xmlns="http://maven.apache.org/plugins/maven-archetype-plugin/archetype-descriptor/1.0.0" - xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> - <fileSets> - <fileSet filtered="true" packaged="true" encoding="UTF-8"> - <directory>src/main/java</directory> - <includes> - <include>**/*.java</include> - </includes> - </fileSet> - <fileSet filtered="true" packaged="false" encoding="UTF-8"> - <directory>src/main/resources</directory> - <includes> - <include>**/*.html</include> - <include>**/*.js</include> - <include>**/*.css</include> - </includes> - </fileSet> - </fileSets> -</archetype-descriptor> diff --git a/framework/src/onos/tools/package/archetypes/uitab/src/main/resources/archetype-resources/pom.xml b/framework/src/onos/tools/package/archetypes/uitab/src/main/resources/archetype-resources/pom.xml deleted file mode 100644 index 3dbd873e..00000000 --- a/framework/src/onos/tools/package/archetypes/uitab/src/main/resources/archetype-resources/pom.xml +++ /dev/null @@ -1,140 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> - -<!-- - ~ 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. - --> -<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> - <modelVersion>4.0.0</modelVersion> - - <groupId>${groupId}</groupId> - <artifactId>${artifactId}</artifactId> - <version>${version}</version> - <packaging>bundle</packaging> - - <description>ONOS OSGi UI Table-View bundle archetype</description> - <url>http://onosproject.org</url> - - <properties> - <onos.version>1.4.0-rc1</onos.version> - <!-- Uncomment to generate ONOS app from this module. - <onos.app.name>org.foo.app</onos.app.name> - <onos.app.origin>Foo, Inc.</onos.app.origin> - --> - </properties> - - <dependencies> - <dependency> - <groupId>org.onosproject</groupId> - <artifactId>onos-api</artifactId> - <version>${onos.version}</version> - </dependency> - - <dependency> - <groupId>org.onosproject</groupId> - <artifactId>onlab-osgi</artifactId> - <version>${onos.version}</version> - </dependency> - - <dependency> - <groupId>junit</groupId> - <artifactId>junit</artifactId> - <version>4.11</version> - <scope>test</scope> - </dependency> - - <dependency> - <groupId>org.onosproject</groupId> - <artifactId>onos-api</artifactId> - <version>${onos.version}</version> - <scope>test</scope> - <classifier>tests</classifier> - </dependency> - - <dependency> - <groupId>org.apache.felix</groupId> - <artifactId>org.apache.felix.scr.annotations</artifactId> - <version>1.9.8</version> - <scope>provided</scope> - </dependency> - </dependencies> - - <build> - <plugins> - <plugin> - <groupId>org.apache.felix</groupId> - <artifactId>maven-bundle-plugin</artifactId> - <version>2.5.3</version> - <extensions>true</extensions> - </plugin> - <plugin> - <groupId>org.apache.maven.plugins</groupId> - <artifactId>maven-compiler-plugin</artifactId> - <version>2.5.1</version> - <configuration> - <source>1.8</source> - <target>1.8</target> - </configuration> - </plugin> - <plugin> - <groupId>org.apache.felix</groupId> - <artifactId>maven-scr-plugin</artifactId> - <version>1.20.0</version> - <executions> - <execution> - <id>generate-scr-srcdescriptor</id> - <goals> - <goal>scr</goal> - </goals> - </execution> - </executions> - <configuration> - <supportedProjectTypes> - <supportedProjectType>bundle</supportedProjectType> - <supportedProjectType>war</supportedProjectType> - </supportedProjectTypes> - </configuration> - </plugin> - <plugin> - <groupId>org.onosproject</groupId> - <artifactId>onos-maven-plugin</artifactId> - <version>1.5</version> - <executions> - <execution> - <id>cfg</id> - <phase>generate-resources</phase> - <goals> - <goal>cfg</goal> - </goals> - </execution> - <execution> - <id>swagger</id> - <phase>generate-sources</phase> - <goals> - <goal>swagger</goal> - </goals> - </execution> - <execution> - <id>app</id> - <phase>package</phase> - <goals> - <goal>app</goal> - </goals> - </execution> - </executions> - </plugin> - </plugins> - </build> - -</project> diff --git a/framework/src/onos/tools/package/archetypes/uitab/src/main/resources/archetype-resources/src/main/java/AppUiTableComponent.java b/framework/src/onos/tools/package/archetypes/uitab/src/main/resources/archetype-resources/src/main/java/AppUiTableComponent.java deleted file mode 100644 index 263564ce..00000000 --- a/framework/src/onos/tools/package/archetypes/uitab/src/main/resources/archetype-resources/src/main/java/AppUiTableComponent.java +++ /dev/null @@ -1,80 +0,0 @@ -#set( $symbol_pound = '#' ) -#set( $symbol_dollar = '$' ) -#set( $symbol_escape = '\' ) -/* - * Copyright 2014,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 ${package}; - -import com.google.common.collect.ImmutableList; -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.ui.UiExtension; -import org.onosproject.ui.UiExtensionService; -import org.onosproject.ui.UiMessageHandlerFactory; -import org.onosproject.ui.UiView; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import java.util.List; - -/** - * Skeletal ONOS UI Table-View application component. - */ -@Component(immediate = true) -public class AppUiTableComponent { - - private static final String VIEW_ID = "sampleTable"; - private static final String VIEW_TEXT = "Sample Table"; - - private final Logger log = LoggerFactory.getLogger(getClass()); - - @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY) - protected UiExtensionService uiExtensionService; - - // List of application views - private final List<UiView> uiViews = ImmutableList.of( - new UiView(UiView.Category.OTHER, VIEW_ID, VIEW_TEXT) - ); - - // Factory for UI message handlers - private final UiMessageHandlerFactory messageHandlerFactory = - () -> ImmutableList.of( - new AppUiTableMessageHandler() - ); - - // Application UI extension - protected UiExtension extension = - new UiExtension.Builder(getClass().getClassLoader(), uiViews) - .resourcePath(VIEW_ID) - .messageHandlerFactory(messageHandlerFactory) - .build(); - - @Activate - protected void activate() { - uiExtensionService.register(extension); - log.info("Started"); - } - - @Deactivate - protected void deactivate() { - uiExtensionService.unregister(extension); - log.info("Stopped"); - } - -} diff --git a/framework/src/onos/tools/package/archetypes/uitab/src/main/resources/archetype-resources/src/main/java/AppUiTableMessageHandler.java b/framework/src/onos/tools/package/archetypes/uitab/src/main/resources/archetype-resources/src/main/java/AppUiTableMessageHandler.java deleted file mode 100644 index a673f1fd..00000000 --- a/framework/src/onos/tools/package/archetypes/uitab/src/main/resources/archetype-resources/src/main/java/AppUiTableMessageHandler.java +++ /dev/null @@ -1,190 +0,0 @@ -#set( $symbol_pound = '#' ) -#set( $symbol_dollar = '$' ) -#set( $symbol_escape = '\' ) -/* - * Copyright 2014,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 ${package}; - -import com.fasterxml.jackson.databind.node.ObjectNode; -import com.google.common.collect.ImmutableSet; -import org.onosproject.ui.RequestHandler; -import org.onosproject.ui.UiMessageHandler; -import org.onosproject.ui.table.TableModel; -import org.onosproject.ui.table.TableRequestHandler; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import java.lang.Override; -import java.util.ArrayList; -import java.util.Collection; -import java.util.List; - -/** - * Skeletal ONOS UI Table-View message handler. - */ -public class AppUiTableMessageHandler extends UiMessageHandler { - - private static final String SAMPLE_TABLE_DATA_REQ = "sampleTableDataRequest"; - private static final String SAMPLE_TABLE_DATA_RESP = "sampleTableDataResponse"; - private static final String SAMPLE_TABLES = "sampleTables"; - - private static final String SAMPLE_TABLE_DETAIL_REQ = "sampleTableDetailsRequest"; - private static final String SAMPLE_TABLE_DETAIL_RESP = "sampleTableDetailsResponse"; - private static final String DETAILS = "details"; - - private static final String ID = "id"; - private static final String LABEL = "label"; - private static final String CODE = "code"; - private static final String COMMENT = "comment"; - private static final String RESULT = "result"; - - private static final String[] COLUMN_IDS = { ID, LABEL, CODE }; - - private final Logger log = LoggerFactory.getLogger(getClass()); - - - @Override - protected Collection<RequestHandler> createRequestHandlers() { - return ImmutableSet.of( - new SampleTableDataRequestHandler(), - new SampleTableDetailRequestHandler() - ); - } - - // handler for sample table requests - private final class SampleTableDataRequestHandler extends TableRequestHandler { - - private SampleTableDataRequestHandler() { - super(SAMPLE_TABLE_DATA_REQ, SAMPLE_TABLE_DATA_RESP, SAMPLE_TABLES); - } - - // if necessary, override defaultColumnId() -- if it isn't "id" - - @Override - protected String[] getColumnIds() { - return COLUMN_IDS; - } - - // if required, override createTableModel() to set column formatters / comparators - - @Override - protected void populateTable(TableModel tm, ObjectNode payload) { - // === NOTE: the table model supplied here will have been created - // via a call to createTableModel(). To assign non-default - // cell formatters or comparators to the table model, override - // createTableModel() and set them there. - - // === retrieve table row items from some service... - // SomeService ss = get(SomeService.class); - // List<Item> items = ss.getItems() - - // fake data for demonstration purposes... - List<Item> items = getItems(); - for (Item item: items) { - populateRow(tm.addRow(), item); - } - } - - private void populateRow(TableModel.Row row, Item item) { - row.cell(ID, item.id()) - .cell(LABEL, item.label()) - .cell(CODE, item.code()); - } - } - - - // handler for sample item details requests - private final class SampleTableDetailRequestHandler extends RequestHandler { - - private SampleTableDetailRequestHandler() { - super(SAMPLE_TABLE_DETAIL_REQ); - } - - @Override - public void process(long sid, ObjectNode payload) { - String id = string(payload, ID, "(none)"); - - // SomeService ss = get(SomeService.class); - // Item item = ss.getItemDetails(id) - - // fake data for demonstration purposes... - Item item = getItem(id); - - ObjectNode rootNode = objectNode(); - ObjectNode data = objectNode(); - rootNode.set(DETAILS, data); - - if (item == null) { - rootNode.put(RESULT, "Item with id '" + id + "' not found"); - log.warn("attempted to get item detail for id '{}'", id); - - } else { - rootNode.put(RESULT, "Found item with id '" + id + "'"); - - data.put(ID, item.id()); - data.put(LABEL, item.label()); - data.put(CODE, item.code()); - data.put(COMMENT, "Some arbitrary comment"); - } - - sendMessage(SAMPLE_TABLE_DETAIL_RESP, 0, rootNode); - } - } - - - // =================================================================== - // NOTE: The code below this line is to create fake data for this - // sample code. Normally you would use existing services to - // provide real data. - - // Lookup a single item. - private static Item getItem(String id) { - // We realize this code is really inefficient, but - // it suffices for our purposes of demonstration... - for (Item item : getItems()) { - if (item.id().equals(id)) { - return item; - } - } - return null; - } - - // Produce a list of items. - private static List<Item> getItems() { - List<Item> items = new ArrayList<>(); - items.add(new Item("item-1", "foo", 42)); - items.add(new Item("item-2", "bar", 99)); - items.add(new Item("item-3", "baz", 65)); - return items; - } - - // Simple model class to provide sample data - private static class Item { - private final String id; - private final String label; - private final int code; - - Item(String id, String label, int code) { - this.id = id; - this.label = label; - this.code = code; - } - - String id() { return id; } - String label() { return label; } - int code() { return code; } - } -}
\ No newline at end of file diff --git a/framework/src/onos/tools/package/archetypes/uitab/src/main/resources/archetype-resources/src/main/resources/app/view/sampleTable/sampleTable.css b/framework/src/onos/tools/package/archetypes/uitab/src/main/resources/archetype-resources/src/main/resources/app/view/sampleTable/sampleTable.css deleted file mode 100644 index 5eb551b3..00000000 --- a/framework/src/onos/tools/package/archetypes/uitab/src/main/resources/archetype-resources/src/main/resources/app/view/sampleTable/sampleTable.css +++ /dev/null @@ -1,35 +0,0 @@ -/* css for sample table view */ - -#ov-sample-table h2 { - display: inline-block; -} - -/* Panel Styling */ -#ov-sample-table-item-details-panel.floatpanel { - position: absolute; - top: 115px; -} - -.light #ov-sample-table-item-details-panel.floatpanel { - background-color: rgb(229, 234, 237); -} -.dark #ov-sample-table-item-details-panel.floatpanel { - background-color: #3A4042; -} - -#ov-sample-table-item-details-panel h3 { - margin: 0; - font-size: large; -} - -#ov-sample-table-item-details-panel h4 { - margin: 0; -} - -#ov-sample-table-item-details-panel td { - padding: 5px; -} -#ov-sample-table-item-details-panel td.label { - font-style: italic; - opacity: 0.8; -} diff --git a/framework/src/onos/tools/package/archetypes/uitab/src/main/resources/archetype-resources/src/main/resources/app/view/sampleTable/sampleTable.html b/framework/src/onos/tools/package/archetypes/uitab/src/main/resources/archetype-resources/src/main/resources/app/view/sampleTable/sampleTable.html deleted file mode 100644 index e20a94d7..00000000 --- a/framework/src/onos/tools/package/archetypes/uitab/src/main/resources/archetype-resources/src/main/resources/app/view/sampleTable/sampleTable.html +++ /dev/null @@ -1,46 +0,0 @@ -<!-- partial HTML --> -<div id="ov-sample-table"> - <div class="tabular-header"> - <h2>Items ({{tableData.length}} total)</h2> - <div class="ctrl-btns"> - <div class="refresh" ng-class="{active: autoRefresh}" - icon icon-id="refresh" icon-size="36" - tooltip tt-msg="autoRefreshTip" - ng-click="toggleRefresh()"></div> - </div> - </div> - - <div class="summary-list" onos-table-resize> - - <div class="table-header" onos-sortable-header> - <table> - <tr> - <td colId="id" sortable>Item ID </td> - <td colId="label" sortable>Label </td> - <td colId="code" sortable>Code </td> - </tr> - </table> - </div> - - <div class="table-body"> - <table> - <tr ng-if="!tableData.length" class="no-data"> - <td colspan="3"> - No Items found - </td> - </tr> - - <tr ng-repeat="item in tableData track by $index" - ng-click="selectCallback($event, item)" - ng-class="{selected: item.id === selId}"> - <td>{{item.id}}</td> - <td>{{item.label}}</td> - <td>{{item.code}}</td> - </tr> - </table> - </div> - - </div> - - <ov-sample-table-item-details-panel></ov-sample-table-item-details-panel> -</div> diff --git a/framework/src/onos/tools/package/archetypes/uitab/src/main/resources/archetype-resources/src/main/resources/app/view/sampleTable/sampleTable.js b/framework/src/onos/tools/package/archetypes/uitab/src/main/resources/archetype-resources/src/main/resources/app/view/sampleTable/sampleTable.js deleted file mode 100644 index 7b925550..00000000 --- a/framework/src/onos/tools/package/archetypes/uitab/src/main/resources/archetype-resources/src/main/resources/app/view/sampleTable/sampleTable.js +++ /dev/null @@ -1,141 +0,0 @@ -// js for sample app table view -(function () { - 'use strict'; - - // injected refs - var $log, $scope, fs, wss; - - // constants - var detailsReq = 'sampleTableDetailsRequest', - detailsResp = 'sampleTableDetailsResponse', - pName = 'ov-sample-table-item-details-panel', - - propOrder = ['id', 'label', 'code'], - friendlyProps = ['Item ID', 'Item Label', 'Special Code']; - - - function addProp(tbody, index, value) { - var tr = tbody.append('tr'); - - function addCell(cls, txt) { - tr.append('td').attr('class', cls).html(txt); - } - addCell('label', friendlyProps[index] + ' :'); - addCell('value', value); - } - - function populatePanel(panel) { - var title = panel.append('h3'), - tbody = panel.append('table').append('tbody'); - - title.text('Item Details'); - - propOrder.forEach(function (prop, i) { - addProp(tbody, i, $scope.panelDetails[prop]); - }); - - panel.append('hr'); - panel.append('h4').text('Comments'); - panel.append('p').text($scope.panelDetails.comment); - } - - function respDetailsCb(data) { - $scope.panelDetails = data.details; - $scope.$apply(); - } - - angular.module('ovSampleTable', []) - .controller('OvSampleTableCtrl', - ['$log', '$scope', 'TableBuilderService', - 'FnService', 'WebSocketService', - - function (_$log_, _$scope_, tbs, _fs_, _wss_) { - $log = _$log_; - $scope = _$scope_; - fs = _fs_; - wss = _wss_; - - var handlers = {}; - $scope.panelDetails = {}; - - // details response handler - handlers[detailsResp] = respDetailsCb; - wss.bindHandlers(handlers); - - // custom selection callback - function selCb($event, row) { - if ($scope.selId) { - wss.sendEvent(detailsReq, { id: row.id }); - } else { - $scope.hidePanel(); - } - $log.debug('Got a click on:', row); - } - - // TableBuilderService creating a table for us - tbs.buildTable({ - scope: $scope, - tag: 'sampleTable', - selCb: selCb - }); - - // cleanup - $scope.$on('$destroy', function () { - wss.unbindHandlers(handlers); - $log.log('OvSampleTableCtrl has been destroyed'); - }); - - $log.log('OvSampleTableCtrl has been created'); - }]) - - .directive('ovSampleTableItemDetailsPanel', ['PanelService', 'KeyService', - function (ps, ks) { - return { - restrict: 'E', - link: function (scope, element, attrs) { - // insert details panel with PanelService - // create the panel - var panel = ps.createPanel(pName, { - width: 200, - margin: 20, - hideMargin: 0 - }); - panel.hide(); - scope.hidePanel = function () { panel.hide(); }; - - function closePanel() { - if (panel.isVisible()) { - $scope.selId = null; - panel.hide(); - return true; - } - return false; - } - - // create key bindings to handle panel - ks.keyBindings({ - esc: [closePanel, 'Close the details panel'], - _helpFormat: ['esc'] - }); - ks.gestureNotes([ - ['click', 'Select a row to show item details'] - ]); - - // update the panel's contents when the data is changed - scope.$watch('panelDetails', function () { - if (!fs.isEmptyObject(scope.panelDetails)) { - panel.empty(); - populatePanel(panel); - panel.show(); - } - }); - - // cleanup on destroyed scope - scope.$on('$destroy', function () { - ks.unbindKeys(); - ps.destroyPanel(pName); - }); - } - }; - }]); -}()); diff --git a/framework/src/onos/tools/package/archetypes/uitab/src/main/resources/archetype-resources/src/main/resources/sampleTable/css.html b/framework/src/onos/tools/package/archetypes/uitab/src/main/resources/archetype-resources/src/main/resources/sampleTable/css.html deleted file mode 100644 index 26112b0d..00000000 --- a/framework/src/onos/tools/package/archetypes/uitab/src/main/resources/archetype-resources/src/main/resources/sampleTable/css.html +++ /dev/null @@ -1 +0,0 @@ -<link rel="stylesheet" href="app/view/sampleTable/sampleTable.css">
\ No newline at end of file diff --git a/framework/src/onos/tools/package/archetypes/uitab/src/main/resources/archetype-resources/src/main/resources/sampleTable/js.html b/framework/src/onos/tools/package/archetypes/uitab/src/main/resources/archetype-resources/src/main/resources/sampleTable/js.html deleted file mode 100644 index 4bfa2169..00000000 --- a/framework/src/onos/tools/package/archetypes/uitab/src/main/resources/archetype-resources/src/main/resources/sampleTable/js.html +++ /dev/null @@ -1 +0,0 @@ -<script src="app/view/sampleTable/sampleTable.js"></script>
\ No newline at end of file diff --git a/framework/src/onos/tools/package/archetypes/uitab/src/test/resources/projects/basic/archetype.properties b/framework/src/onos/tools/package/archetypes/uitab/src/test/resources/projects/basic/archetype.properties deleted file mode 100644 index a1213b40..00000000 --- a/framework/src/onos/tools/package/archetypes/uitab/src/test/resources/projects/basic/archetype.properties +++ /dev/null @@ -1,21 +0,0 @@ -# -# Copyright 2014 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. -# - -#Thu Dec 04 09:24:50 PST 2014 -package=it.pkg -version=0.1-SNAPSHOT -groupId=archetype.it -artifactId=basic diff --git a/framework/src/onos/tools/package/archetypes/uitab/src/test/resources/projects/basic/goal.txt b/framework/src/onos/tools/package/archetypes/uitab/src/test/resources/projects/basic/goal.txt deleted file mode 100644 index e69de29b..00000000 --- a/framework/src/onos/tools/package/archetypes/uitab/src/test/resources/projects/basic/goal.txt +++ /dev/null diff --git a/framework/src/onos/tools/package/archetypes/uitopo/pom.xml b/framework/src/onos/tools/package/archetypes/uitopo/pom.xml deleted file mode 100644 index b03c325d..00000000 --- a/framework/src/onos/tools/package/archetypes/uitopo/pom.xml +++ /dev/null @@ -1,31 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!-- - ~ 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. - --> -<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> - <modelVersion>4.0.0</modelVersion> - - <parent> - <groupId>org.onosproject</groupId> - <artifactId>onos-archetypes</artifactId> - <version>1.4.0-rc1</version> - </parent> - - <artifactId>onos-uitopo-archetype</artifactId> - <packaging>maven-archetype</packaging> - - <description>ONOS UI Topology-Overlay overlay archetype</description> - -</project> diff --git a/framework/src/onos/tools/package/archetypes/uitopo/src/main/resources/META-INF/maven/archetype-metadata.xml b/framework/src/onos/tools/package/archetypes/uitopo/src/main/resources/META-INF/maven/archetype-metadata.xml deleted file mode 100644 index 26a9082d..00000000 --- a/framework/src/onos/tools/package/archetypes/uitopo/src/main/resources/META-INF/maven/archetype-metadata.xml +++ /dev/null @@ -1,39 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> - -<!-- - ~ 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. - --> -<archetype-descriptor - xsi:schemaLocation="http://maven.apache.org/plugins/maven-archetype-plugin/archetype-descriptor/1.0.0 http://maven.apache.org/xsd/archetype-descriptor-1.0.0.xsd" - name="onos-uitopo" partial="true" - xmlns="http://maven.apache.org/plugins/maven-archetype-plugin/archetype-descriptor/1.0.0" - xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> - <fileSets> - <fileSet filtered="true" packaged="true" encoding="UTF-8"> - <directory>src/main/java</directory> - <includes> - <include>**/*.java</include> - </includes> - </fileSet> - <fileSet filtered="true" packaged="false" encoding="UTF-8"> - <directory>src/main/resources</directory> - <includes> - <include>**/*.html</include> - <include>**/*.js</include> - <include>**/*.css</include> - </includes> - </fileSet> - </fileSets> -</archetype-descriptor> diff --git a/framework/src/onos/tools/package/archetypes/uitopo/src/main/resources/archetype-resources/pom.xml b/framework/src/onos/tools/package/archetypes/uitopo/src/main/resources/archetype-resources/pom.xml deleted file mode 100644 index 2c97cf48..00000000 --- a/framework/src/onos/tools/package/archetypes/uitopo/src/main/resources/archetype-resources/pom.xml +++ /dev/null @@ -1,140 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> - -<!-- - ~ 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. - --> -<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> - <modelVersion>4.0.0</modelVersion> - - <groupId>${groupId}</groupId> - <artifactId>${artifactId}</artifactId> - <version>${version}</version> - <packaging>bundle</packaging> - - <description>ONOS OSGi UI Topology-Overlay bundle archetype</description> - <url>http://onosproject.org</url> - - <properties> - <onos.version>1.4.0-rc1</onos.version> - <!-- Uncomment to generate ONOS app from this module. - <onos.app.name>org.foo.app</onos.app.name> - <onos.app.origin>Foo, Inc.</onos.app.origin> - --> - </properties> - - <dependencies> - <dependency> - <groupId>org.onosproject</groupId> - <artifactId>onos-api</artifactId> - <version>${onos.version}</version> - </dependency> - - <dependency> - <groupId>org.onosproject</groupId> - <artifactId>onlab-osgi</artifactId> - <version>${onos.version}</version> - </dependency> - - <dependency> - <groupId>junit</groupId> - <artifactId>junit</artifactId> - <version>4.11</version> - <scope>test</scope> - </dependency> - - <dependency> - <groupId>org.onosproject</groupId> - <artifactId>onos-api</artifactId> - <version>${onos.version}</version> - <scope>test</scope> - <classifier>tests</classifier> - </dependency> - - <dependency> - <groupId>org.apache.felix</groupId> - <artifactId>org.apache.felix.scr.annotations</artifactId> - <version>1.9.8</version> - <scope>provided</scope> - </dependency> - </dependencies> - - <build> - <plugins> - <plugin> - <groupId>org.apache.felix</groupId> - <artifactId>maven-bundle-plugin</artifactId> - <version>2.5.3</version> - <extensions>true</extensions> - </plugin> - <plugin> - <groupId>org.apache.maven.plugins</groupId> - <artifactId>maven-compiler-plugin</artifactId> - <version>2.5.1</version> - <configuration> - <source>1.8</source> - <target>1.8</target> - </configuration> - </plugin> - <plugin> - <groupId>org.apache.felix</groupId> - <artifactId>maven-scr-plugin</artifactId> - <version>1.20.0</version> - <executions> - <execution> - <id>generate-scr-srcdescriptor</id> - <goals> - <goal>scr</goal> - </goals> - </execution> - </executions> - <configuration> - <supportedProjectTypes> - <supportedProjectType>bundle</supportedProjectType> - <supportedProjectType>war</supportedProjectType> - </supportedProjectTypes> - </configuration> - </plugin> - <plugin> - <groupId>org.onosproject</groupId> - <artifactId>onos-maven-plugin</artifactId> - <version>1.5</version> - <executions> - <execution> - <id>cfg</id> - <phase>generate-resources</phase> - <goals> - <goal>cfg</goal> - </goals> - </execution> - <execution> - <id>swagger</id> - <phase>generate-sources</phase> - <goals> - <goal>swagger</goal> - </goals> - </execution> - <execution> - <id>app</id> - <phase>package</phase> - <goals> - <goal>app</goal> - </goals> - </execution> - </executions> - </plugin> - </plugins> - </build> - -</project> diff --git a/framework/src/onos/tools/package/archetypes/uitopo/src/main/resources/archetype-resources/src/main/java/AppUiTopovComponent.java b/framework/src/onos/tools/package/archetypes/uitopo/src/main/resources/archetype-resources/src/main/java/AppUiTopovComponent.java deleted file mode 100644 index fa62a784..00000000 --- a/framework/src/onos/tools/package/archetypes/uitopo/src/main/resources/archetype-resources/src/main/java/AppUiTopovComponent.java +++ /dev/null @@ -1,89 +0,0 @@ -#set( $symbol_pound = '#' ) -#set( $symbol_dollar = '$' ) -#set( $symbol_escape = '\' ) -/* - * Copyright 2014,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 ${package}; - -import com.google.common.collect.ImmutableList; -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.ui.UiExtension; -import org.onosproject.ui.UiExtensionService; -import org.onosproject.ui.UiMessageHandlerFactory; -import org.onosproject.ui.UiTopoOverlayFactory; -import org.onosproject.ui.UiView; -import org.onosproject.ui.UiViewHidden; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import java.util.List; - -/** - * Skeletal ONOS UI Topology-Overlay application component. - */ -@Component(immediate = true) -public class AppUiTopovComponent { - - private static final ClassLoader CL = AppUiTopovComponent.class.getClassLoader(); - private static final String VIEW_ID = "sampleTopov"; - - private final Logger log = LoggerFactory.getLogger(getClass()); - - @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY) - protected UiExtensionService uiExtensionService; - - // List of application views - private final List<UiView> uiViews = ImmutableList.of( - new UiViewHidden(VIEW_ID) - ); - - // Factory for UI message handlers - private final UiMessageHandlerFactory messageHandlerFactory = - () -> ImmutableList.of( - new AppUiTopovMessageHandler() - ); - - // Factory for UI topology overlays - private final UiTopoOverlayFactory topoOverlayFactory = - () -> ImmutableList.of( - new AppUiTopovOverlay() - ); - - // Application UI extension - protected UiExtension extension = - new UiExtension.Builder(CL, uiViews) - .resourcePath(VIEW_ID) - .messageHandlerFactory(messageHandlerFactory) - .topoOverlayFactory(topoOverlayFactory) - .build(); - - @Activate - protected void activate() { - uiExtensionService.register(extension); - log.info("Started"); - } - - @Deactivate - protected void deactivate() { - uiExtensionService.unregister(extension); - log.info("Stopped"); - } - -} diff --git a/framework/src/onos/tools/package/archetypes/uitopo/src/main/resources/archetype-resources/src/main/java/AppUiTopovMessageHandler.java b/framework/src/onos/tools/package/archetypes/uitopo/src/main/resources/archetype-resources/src/main/java/AppUiTopovMessageHandler.java deleted file mode 100644 index 65e3489f..00000000 --- a/framework/src/onos/tools/package/archetypes/uitopo/src/main/resources/archetype-resources/src/main/java/AppUiTopovMessageHandler.java +++ /dev/null @@ -1,337 +0,0 @@ -#set( $symbol_pound = '#' ) -#set( $symbol_dollar = '$' ) -#set( $symbol_escape = '\' ) -/* - * Copyright 2014,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 ${package}; - -import com.fasterxml.jackson.databind.node.ObjectNode; -import com.google.common.base.Strings; -import com.google.common.collect.ImmutableSet; -import org.onlab.osgi.ServiceDirectory; -import org.onosproject.net.Device; -import org.onosproject.net.DeviceId; -import org.onosproject.net.Element; -import org.onosproject.net.HostId; -import org.onosproject.net.Link; -import org.onosproject.net.device.DeviceService; -import org.onosproject.net.host.HostService; -import org.onosproject.net.link.LinkService; -import org.onosproject.ui.RequestHandler; -import org.onosproject.ui.UiConnection; -import org.onosproject.ui.UiMessageHandler; -import org.onosproject.ui.topo.DeviceHighlight; -import org.onosproject.ui.topo.Highlights; -import org.onosproject.ui.topo.NodeBadge; -import org.onosproject.ui.topo.NodeBadge.Status; -import org.onosproject.ui.topo.TopoJson; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import java.util.Collection; -import java.util.HashSet; -import java.util.Set; -import java.util.Timer; -import java.util.TimerTask; - -/** - * Skeletal ONOS UI Topology-Overlay message handler. - */ -public class AppUiTopovMessageHandler extends UiMessageHandler { - - private static final String SAMPLE_TOPOV_DISPLAY_START = "sampleTopovDisplayStart"; - private static final String SAMPLE_TOPOV_DISPLAY_UPDATE = "sampleTopovDisplayUpdate"; - private static final String SAMPLE_TOPOV_DISPLAY_STOP = "sampleTopovDisplayStop"; - - private static final String ID = "id"; - private static final String MODE = "mode"; - - private static final long UPDATE_PERIOD_MS = 1000; - - private static final Link[] EMPTY_LINK_SET = new Link[0]; - - private enum Mode { IDLE, MOUSE, LINK } - - private final Logger log = LoggerFactory.getLogger(getClass()); - - private DeviceService deviceService; - private HostService hostService; - private LinkService linkService; - - private final Timer timer = new Timer("sample-overlay"); - private TimerTask demoTask = null; - private Mode currentMode = Mode.IDLE; - private Element elementOfNote; - private Link[] linkSet = EMPTY_LINK_SET; - private int linkIndex; - - - // ===============-=-=-=-=-=-======================-=-=-=-=-=-=-================================ - - - @Override - public void init(UiConnection connection, ServiceDirectory directory) { - super.init(connection, directory); - deviceService = directory.get(DeviceService.class); - hostService = directory.get(HostService.class); - linkService = directory.get(LinkService.class); - } - - @Override - protected Collection<RequestHandler> createRequestHandlers() { - return ImmutableSet.of( - new DisplayStartHandler(), - new DisplayUpdateHandler(), - new DisplayStopHandler() - ); - } - - // === ------------------------- - // === Handler classes - - private final class DisplayStartHandler extends RequestHandler { - public DisplayStartHandler() { - super(SAMPLE_TOPOV_DISPLAY_START); - } - - @Override - public void process(long sid, ObjectNode payload) { - String mode = string(payload, MODE); - - log.debug("Start Display: mode [{}]", mode); - clearState(); - clearForMode(); - - switch (mode) { - case "mouse": - currentMode = Mode.MOUSE; - cancelTask(); - sendMouseData(); - break; - - case "link": - currentMode = Mode.LINK; - scheduleTask(); - initLinkSet(); - sendLinkData(); - break; - - default: - currentMode = Mode.IDLE; - cancelTask(); - break; - } - } - } - - private final class DisplayUpdateHandler extends RequestHandler { - public DisplayUpdateHandler() { - super(SAMPLE_TOPOV_DISPLAY_UPDATE); - } - - @Override - public void process(long sid, ObjectNode payload) { - String id = string(payload, ID); - log.debug("Update Display: id [{}]", id); - if (!Strings.isNullOrEmpty(id)) { - updateForMode(id); - } else { - clearForMode(); - } - } - } - - private final class DisplayStopHandler extends RequestHandler { - public DisplayStopHandler() { - super(SAMPLE_TOPOV_DISPLAY_STOP); - } - - @Override - public void process(long sid, ObjectNode payload) { - log.debug("Stop Display"); - cancelTask(); - clearState(); - clearForMode(); - } - } - - // === ------------ - - private void clearState() { - currentMode = Mode.IDLE; - elementOfNote = null; - linkSet = EMPTY_LINK_SET; - } - - private void updateForMode(String id) { - log.debug("host service: {}", hostService); - log.debug("device service: {}", deviceService); - - try { - HostId hid = HostId.hostId(id); - log.debug("host id {}", hid); - elementOfNote = hostService.getHost(hid); - log.debug("host element {}", elementOfNote); - - } catch (Exception e) { - try { - DeviceId did = DeviceId.deviceId(id); - log.debug("device id {}", did); - elementOfNote = deviceService.getDevice(did); - log.debug("device element {}", elementOfNote); - - } catch (Exception e2) { - log.debug("Unable to process ID [{}]", id); - elementOfNote = null; - } - } - - switch (currentMode) { - case MOUSE: - sendMouseData(); - break; - - case LINK: - sendLinkData(); - break; - - default: - break; - } - - } - - private void clearForMode() { - sendHighlights(new Highlights()); - } - - private void sendHighlights(Highlights highlights) { - sendMessage(TopoJson.highlightsMessage(highlights)); - } - - - private void sendMouseData() { - if (elementOfNote != null && elementOfNote instanceof Device) { - DeviceId devId = (DeviceId) elementOfNote.id(); - Set<Link> links = linkService.getDeviceEgressLinks(devId); - Highlights highlights = fromLinks(links, devId); - addDeviceBadge(highlights, devId, links.size()); - sendHighlights(highlights); - } - // Note: could also process Host, if available - } - - private void addDeviceBadge(Highlights h, DeviceId devId, int n) { - DeviceHighlight dh = new DeviceHighlight(devId.toString()); - dh.setBadge(createBadge(n)); - h.add(dh); - } - - private NodeBadge createBadge(int n) { - Status status = n > 3 ? Status.ERROR : Status.WARN; - String noun = n > 3 ? "(critical)" : "(problematic)"; - String msg = "Egress links: " + n + " " + noun; - return NodeBadge.number(status, n, msg); - } - - private Highlights fromLinks(Set<Link> links, DeviceId devId) { - DemoLinkMap linkMap = new DemoLinkMap(); - if (links != null) { - log.debug("Processing {} links", links.size()); - links.forEach(linkMap::add); - } else { - log.debug("No egress links found for device {}", devId); - } - - Highlights highlights = new Highlights(); - - for (DemoLink dlink : linkMap.biLinks()) { - dlink.makeImportant().setLabel("Yo!"); - highlights.add(dlink.highlight(null)); - } - return highlights; - } - - private void initLinkSet() { - Set<Link> links = new HashSet<>(); - for (Link link : linkService.getActiveLinks()) { - links.add(link); - } - linkSet = links.toArray(new Link[links.size()]); - linkIndex = 0; - log.debug("initialized link set to {}", linkSet.length); - } - - private void sendLinkData() { - DemoLinkMap linkMap = new DemoLinkMap(); - for (Link link : linkSet) { - linkMap.add(link); - } - DemoLink dl = linkMap.add(linkSet[linkIndex]); - dl.makeImportant().setLabel(Integer.toString(linkIndex)); - log.debug("sending link data (index {})", linkIndex); - - linkIndex += 1; - if (linkIndex >= linkSet.length) { - linkIndex = 0; - } - - Highlights highlights = new Highlights(); - for (DemoLink dlink : linkMap.biLinks()) { - highlights.add(dlink.highlight(null)); - } - - sendHighlights(highlights); - } - - private synchronized void scheduleTask() { - if (demoTask == null) { - log.debug("Starting up demo task..."); - demoTask = new DisplayUpdateTask(); - timer.schedule(demoTask, UPDATE_PERIOD_MS, UPDATE_PERIOD_MS); - } else { - log.debug("(demo task already running"); - } - } - - private synchronized void cancelTask() { - if (demoTask != null) { - demoTask.cancel(); - demoTask = null; - } - } - - - private class DisplayUpdateTask extends TimerTask { - @Override - public void run() { - try { - switch (currentMode) { - case LINK: - sendLinkData(); - break; - - default: - break; - } - } catch (Exception e) { - log.warn("Unable to process demo task: {}", e.getMessage()); - log.debug("Oops", e); - } - } - } - -}
\ No newline at end of file diff --git a/framework/src/onos/tools/package/archetypes/uitopo/src/main/resources/archetype-resources/src/main/java/AppUiTopovOverlay.java b/framework/src/onos/tools/package/archetypes/uitopo/src/main/resources/archetype-resources/src/main/java/AppUiTopovOverlay.java deleted file mode 100644 index 48e75a5a..00000000 --- a/framework/src/onos/tools/package/archetypes/uitopo/src/main/resources/archetype-resources/src/main/java/AppUiTopovOverlay.java +++ /dev/null @@ -1,82 +0,0 @@ -#set( $symbol_pound = '#' ) -#set( $symbol_dollar = '$' ) -#set( $symbol_escape = '\' ) -/* - * Copyright 2014,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 ${package}; - -import org.onosproject.net.DeviceId; -import org.onosproject.ui.UiTopoOverlay; -import org.onosproject.ui.topo.ButtonId; -import org.onosproject.ui.topo.PropertyPanel; -import org.onosproject.ui.topo.TopoConstants.CoreButtons; -import org.onosproject.ui.topo.TopoConstants.Glyphs; - -import static org.onosproject.ui.topo.TopoConstants.Properties.FLOWS; -import static org.onosproject.ui.topo.TopoConstants.Properties.INTENTS; -import static org.onosproject.ui.topo.TopoConstants.Properties.LATITUDE; -import static org.onosproject.ui.topo.TopoConstants.Properties.LONGITUDE; -import static org.onosproject.ui.topo.TopoConstants.Properties.TOPOLOGY_SSCS; -import static org.onosproject.ui.topo.TopoConstants.Properties.TUNNELS; -import static org.onosproject.ui.topo.TopoConstants.Properties.VERSION; - -/** - * Our topology overlay. - */ -public class AppUiTopovOverlay extends UiTopoOverlay { - - // NOTE: this must match the ID defined in sampleTopov.js - private static final String OVERLAY_ID = "meowster-overlay"; - - private static final String MY_TITLE = "My App Rocks!"; - private static final String MY_VERSION = "Beta-1.0.0042"; - private static final String MY_DEVICE_TITLE = "I changed the title"; - - private static final ButtonId FOO_BUTTON = new ButtonId("foo"); - private static final ButtonId BAR_BUTTON = new ButtonId("bar"); - - public AppUiTopovOverlay() { - super(OVERLAY_ID); - } - - - @Override - public void modifySummary(PropertyPanel pp) { - pp.title(MY_TITLE) - .typeId(Glyphs.CROWN) - .removeProps( - TOPOLOGY_SSCS, - INTENTS, - TUNNELS, - FLOWS, - VERSION - ) - .addProp(VERSION, MY_VERSION); - } - - @Override - public void modifyDeviceDetails(PropertyPanel pp, DeviceId deviceId) { - pp.title(MY_DEVICE_TITLE); - pp.removeProps(LATITUDE, LONGITUDE); - - pp.addButton(FOO_BUTTON) - .addButton(BAR_BUTTON); - - pp.removeButtons(CoreButtons.SHOW_PORT_VIEW) - .removeButtons(CoreButtons.SHOW_GROUP_VIEW); - } - -} diff --git a/framework/src/onos/tools/package/archetypes/uitopo/src/main/resources/archetype-resources/src/main/java/DemoLink.java b/framework/src/onos/tools/package/archetypes/uitopo/src/main/resources/archetype-resources/src/main/java/DemoLink.java deleted file mode 100644 index 4a97f7bd..00000000 --- a/framework/src/onos/tools/package/archetypes/uitopo/src/main/resources/archetype-resources/src/main/java/DemoLink.java +++ /dev/null @@ -1,57 +0,0 @@ -#set( $symbol_pound = '#' ) -#set( $symbol_dollar = '$' ) -#set( $symbol_escape = '\' ) -/* - * Copyright 2014,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 ${package}; - -import org.onosproject.net.Link; -import org.onosproject.net.LinkKey; -import org.onosproject.ui.topo.BiLink; -import org.onosproject.ui.topo.LinkHighlight; -import org.onosproject.ui.topo.LinkHighlight.Flavor; - -/** - * Our demo concrete class of a bi-link. We give it state so we can decide - * how to create link highlights. - */ -public class DemoLink extends BiLink { - - private boolean important = false; - private String label = null; - - public DemoLink(LinkKey key, Link link) { - super(key, link); - } - - public DemoLink makeImportant() { - important = true; - return this; - } - - public DemoLink setLabel(String label) { - this.label = label; - return this; - } - - @Override - public LinkHighlight highlight(Enum<?> anEnum) { - Flavor flavor = important ? Flavor.PRIMARY_HIGHLIGHT - : Flavor.SECONDARY_HIGHLIGHT; - return new LinkHighlight(this.linkId(), flavor) - .setLabel(label); - } -} diff --git a/framework/src/onos/tools/package/archetypes/uitopo/src/main/resources/archetype-resources/src/main/java/DemoLinkMap.java b/framework/src/onos/tools/package/archetypes/uitopo/src/main/resources/archetype-resources/src/main/java/DemoLinkMap.java deleted file mode 100644 index cc13d998..00000000 --- a/framework/src/onos/tools/package/archetypes/uitopo/src/main/resources/archetype-resources/src/main/java/DemoLinkMap.java +++ /dev/null @@ -1,33 +0,0 @@ -#set( $symbol_pound = '#' ) -#set( $symbol_dollar = '$' ) -#set( $symbol_escape = '\' ) -/* - * Copyright 2014,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 ${package}; - -import org.onosproject.net.Link; -import org.onosproject.net.LinkKey; -import org.onosproject.ui.topo.BiLinkMap; - -/** - * Our concrete link map. - */ -public class DemoLinkMap extends BiLinkMap<DemoLink> { - @Override - protected DemoLink create(LinkKey linkKey, Link link) { - return new DemoLink(linkKey, link); - } -} diff --git a/framework/src/onos/tools/package/archetypes/uitopo/src/main/resources/archetype-resources/src/main/resources/app/view/sampleTopov/sampleTopov.css b/framework/src/onos/tools/package/archetypes/uitopo/src/main/resources/archetype-resources/src/main/resources/app/view/sampleTopov/sampleTopov.css deleted file mode 100644 index cbf460f9..00000000 --- a/framework/src/onos/tools/package/archetypes/uitopo/src/main/resources/archetype-resources/src/main/resources/app/view/sampleTopov/sampleTopov.css +++ /dev/null @@ -1,2 +0,0 @@ -/* css for sample app topology overlay */ - diff --git a/framework/src/onos/tools/package/archetypes/uitopo/src/main/resources/archetype-resources/src/main/resources/app/view/sampleTopov/sampleTopov.html b/framework/src/onos/tools/package/archetypes/uitopo/src/main/resources/archetype-resources/src/main/resources/app/view/sampleTopov/sampleTopov.html deleted file mode 100644 index b1c9acbb..00000000 --- a/framework/src/onos/tools/package/archetypes/uitopo/src/main/resources/archetype-resources/src/main/resources/app/view/sampleTopov/sampleTopov.html +++ /dev/null @@ -1,4 +0,0 @@ -<!-- partial HTML --> -<div id="ov-sample-topov"> - <p>This is a hidden view .. just a placeholder to house the javascript</p> -</div> diff --git a/framework/src/onos/tools/package/archetypes/uitopo/src/main/resources/archetype-resources/src/main/resources/app/view/sampleTopov/sampleTopovDemo.js b/framework/src/onos/tools/package/archetypes/uitopo/src/main/resources/archetype-resources/src/main/resources/app/view/sampleTopov/sampleTopovDemo.js deleted file mode 100644 index 328380c0..00000000 --- a/framework/src/onos/tools/package/archetypes/uitopo/src/main/resources/archetype-resources/src/main/resources/app/view/sampleTopov/sampleTopovDemo.js +++ /dev/null @@ -1,104 +0,0 @@ -/* - * 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. - */ - -/* - Sample Demo module. This contains the "business logic" for the topology - overlay that we are implementing. - */ - -(function () { - 'use strict'; - - // injected refs - var $log, fs, flash, wss; - - // constants - var displayStart = 'sampleTopovDisplayStart', - displayUpdate = 'sampleTopovDisplayUpdate', - displayStop = 'sampleTopovDisplayStop'; - - // internal state - var currentMode = null; - - - // === --------------------------- - // === Helper functions - - function sendDisplayStart(mode) { - wss.sendEvent(displayStart, { - mode: mode - }); - } - - function sendDisplayUpdate(what) { - wss.sendEvent(displayUpdate, { - id: what ? what.id : '' - }); - } - - function sendDisplayStop() { - wss.sendEvent(displayStop); - } - - // === --------------------------- - // === Main API functions - - function startDisplay(mode) { - if (currentMode === mode) { - $log.debug('(in mode', mode, 'already)'); - } else { - currentMode = mode; - sendDisplayStart(mode); - flash.flash('Starting display mode: ' + mode); - } - } - - function updateDisplay(m) { - if (currentMode) { - sendDisplayUpdate(m); - } - } - - function stopDisplay() { - if (currentMode) { - currentMode = null; - sendDisplayStop(); - flash.flash('Canceling display mode'); - return true; - } - return false; - } - - // === --------------------------- - // === Module Factory Definition - - angular.module('ovSampleTopov', []) - .factory('SampleTopovDemoService', - ['$log', 'FnService', 'FlashService', 'WebSocketService', - - function (_$log_, _fs_, _flash_, _wss_) { - $log = _$log_; - fs = _fs_; - flash = _flash_; - wss = _wss_; - - return { - startDisplay: startDisplay, - updateDisplay: updateDisplay, - stopDisplay: stopDisplay - }; - }]); -}()); diff --git a/framework/src/onos/tools/package/archetypes/uitopo/src/main/resources/archetype-resources/src/main/resources/app/view/sampleTopov/sampleTopovOverlay.js b/framework/src/onos/tools/package/archetypes/uitopo/src/main/resources/archetype-resources/src/main/resources/app/view/sampleTopov/sampleTopovOverlay.js deleted file mode 100644 index 7ebc030a..00000000 --- a/framework/src/onos/tools/package/archetypes/uitopo/src/main/resources/archetype-resources/src/main/resources/app/view/sampleTopov/sampleTopovOverlay.js +++ /dev/null @@ -1,143 +0,0 @@ -// sample topology overlay - client side -// -// This is the glue that binds our business logic (in sampleTopovDemo.js) -// to the overlay framework. - -(function () { - 'use strict'; - - // injected refs - var $log, tov, stds; - - // internal state should be kept in the service module (not here) - - // our overlay definition - var overlay = { - // NOTE: this must match the ID defined in AppUiTopovOverlay - overlayId: 'meowster-overlay', - glyphId: '*star4', - tooltip: 'Sample Meowster Topo Overlay', - - // These glyphs get installed using the overlayId as a prefix. - // e.g. 'star4' is installed as 'meowster-overlay-star4' - // They can be referenced (from this overlay) as '*star4' - // That is, the '*' prefix stands in for 'meowster-overlay-' - glyphs: { - star4: { - vb: '0 0 8 8', - d: 'M1,4l2,-1l1,-2l1,2l2,1l-2,1l-1,2l-1,-2z' - }, - banner: { - vb: '0 0 6 6', - d: 'M1,1v4l2,-2l2,2v-4z' - } - }, - - activate: function () { - $log.debug("Sample topology overlay ACTIVATED"); - }, - deactivate: function () { - stds.stopDisplay(); - $log.debug("Sample topology overlay DEACTIVATED"); - }, - - // detail panel button definitions - buttons: { - foo: { - gid: 'chain', - tt: 'A FOO action', - cb: function (data) { - $log.debug('FOO action invoked with data:', data); - } - }, - bar: { - gid: '*banner', - tt: 'A BAR action', - cb: function (data) { - $log.debug('BAR action invoked with data:', data); - } - } - }, - - // Key bindings for traffic overlay buttons - // NOTE: fully qual. button ID is derived from overlay-id and key-name - keyBindings: { - 0: { - cb: function () { stds.stopDisplay(); }, - tt: 'Cancel Display Mode', - gid: 'xMark' - }, - V: { - cb: function () { stds.startDisplay('mouse'); }, - tt: 'Start Mouse Mode', - gid: '*banner' - }, - F: { - cb: function () { stds.startDisplay('link'); }, - tt: 'Start Link Mode', - gid: 'chain' - }, - G: { - cb: buttonCallback, - tt: 'Uses the G key', - gid: 'crown' - }, - - _keyOrder: [ - '0', 'V', 'F', 'G' - ] - }, - - hooks: { - // hook for handling escape key - // Must return true to consume ESC, false otherwise. - escape: function () { - // Must return true to consume ESC, false otherwise. - return stds.stopDisplay(); - }, - - // hooks for when the selection changes... - empty: function () { - selectionCallback('empty'); - }, - single: function (data) { - selectionCallback('single', data); - }, - multi: function (selectOrder) { - selectionCallback('multi', selectOrder); - tov.addDetailButton('foo'); - tov.addDetailButton('bar'); - }, - mouseover: function (m) { - // m has id, class, and type properties - $log.debug('mouseover:', m); - stds.updateDisplay(m); - }, - mouseout: function () { - $log.debug('mouseout'); - stds.updateDisplay(); - } - } - }; - - - function buttonCallback(x) { - $log.debug('Toolbar-button callback', x); - } - - function selectionCallback(x, d) { - $log.debug('Selection callback', x, d); - } - - // invoke code to register with the overlay service - angular.module('ovSampleTopov') - .run(['$log', 'TopoOverlayService', 'SampleTopovDemoService', - - function (_$log_, _tov_, _stds_) { - $log = _$log_; - tov = _tov_; - stds = _stds_; - tov.register(overlay); - }]); - -}()); diff --git a/framework/src/onos/tools/package/archetypes/uitopo/src/main/resources/archetype-resources/src/main/resources/sampleTopov/css.html b/framework/src/onos/tools/package/archetypes/uitopo/src/main/resources/archetype-resources/src/main/resources/sampleTopov/css.html deleted file mode 100644 index 0ed6f53c..00000000 --- a/framework/src/onos/tools/package/archetypes/uitopo/src/main/resources/archetype-resources/src/main/resources/sampleTopov/css.html +++ /dev/null @@ -1 +0,0 @@ -<link rel="stylesheet" href="app/view/sampleTopov/sampleTopov.css">
\ No newline at end of file diff --git a/framework/src/onos/tools/package/archetypes/uitopo/src/main/resources/archetype-resources/src/main/resources/sampleTopov/js.html b/framework/src/onos/tools/package/archetypes/uitopo/src/main/resources/archetype-resources/src/main/resources/sampleTopov/js.html deleted file mode 100644 index 4fed1f08..00000000 --- a/framework/src/onos/tools/package/archetypes/uitopo/src/main/resources/archetype-resources/src/main/resources/sampleTopov/js.html +++ /dev/null @@ -1,2 +0,0 @@ -<script src="app/view/sampleTopov/sampleTopovDemo.js"></script> -<script src="app/view/sampleTopov/sampleTopovOverlay.js"></script>
\ No newline at end of file diff --git a/framework/src/onos/tools/package/archetypes/uitopo/src/test/resources/projects/basic/archetype.properties b/framework/src/onos/tools/package/archetypes/uitopo/src/test/resources/projects/basic/archetype.properties deleted file mode 100644 index a1213b40..00000000 --- a/framework/src/onos/tools/package/archetypes/uitopo/src/test/resources/projects/basic/archetype.properties +++ /dev/null @@ -1,21 +0,0 @@ -# -# Copyright 2014 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. -# - -#Thu Dec 04 09:24:50 PST 2014 -package=it.pkg -version=0.1-SNAPSHOT -groupId=archetype.it -artifactId=basic diff --git a/framework/src/onos/tools/package/archetypes/uitopo/src/test/resources/projects/basic/goal.txt b/framework/src/onos/tools/package/archetypes/uitopo/src/test/resources/projects/basic/goal.txt deleted file mode 100644 index e69de29b..00000000 --- a/framework/src/onos/tools/package/archetypes/uitopo/src/test/resources/projects/basic/goal.txt +++ /dev/null diff --git a/framework/src/onos/tools/package/bin/onos-client b/framework/src/onos/tools/package/bin/onos-client deleted file mode 100755 index 2a37087a..00000000 --- a/framework/src/onos/tools/package/bin/onos-client +++ /dev/null @@ -1,17 +0,0 @@ -#!/bin/bash -# ----------------------------------------------------------------------------- -# ONOS command-line client that uses the built-in Apache Karaf client. -# ----------------------------------------------------------------------------- - -if [ -z "${JAVA_HOME}" ]; then - if [ -x /usr/libexec/java_home ]; then - export JAVA_HOME=$(/usr/libexec/java_home -v 1.8) - elif [ -d /usr/lib/jvm/java-8-oracle ]; then - export JAVA_HOME="/usr/lib/jvm/java-8-oracle" - elif [ -d /usr/lib/jvm/java-7-openjdk-amd64 ]; then - export JAVA_HOME="/usr/lib/jvm/java-7-openjdk-amd64" - fi -fi - -cd $(dirname $0)/../apache-karaf-$KARAF_VERSION/bin -./client -h localhost -u karaf "$@" diff --git a/framework/src/onos/tools/package/bin/onos-config b/framework/src/onos/tools/package/bin/onos-config deleted file mode 100755 index 2265d002..00000000 --- a/framework/src/onos/tools/package/bin/onos-config +++ /dev/null @@ -1,2 +0,0 @@ -#!/bin/bash -echo "This command has been deprecated as this step is no longer required."
\ No newline at end of file diff --git a/framework/src/onos/tools/package/bin/onos-form-cluster b/framework/src/onos/tools/package/bin/onos-form-cluster deleted file mode 100755 index 7a0abda6..00000000 --- a/framework/src/onos/tools/package/bin/onos-form-cluster +++ /dev/null @@ -1,39 +0,0 @@ -#!/bin/bash -# ----------------------------------------------------------------------------- -# Forms ONOS cluster using REST API of each separate instance. -# ----------------------------------------------------------------------------- - -[ $# -lt 2 ] && echo "usage: $(basename $0) ip1 ip2..." && exit 1 - -# Scan arguments for user/password or other options... -while getopts u:p: o; do - case "$o" in - u) user=$OPTARG;; - p) password=$OPTARG;; - esac -done -user=${user:-onos} # user defaults to 'onos' -password=${password:-$user} # password defaults to user name if not specified -let OPC=$OPTIND-1 -shift $OPC - -ip=$1 -shift -nodes=$* - -ipPrefix=${ip%.*} - -aux=/tmp/${ipPrefix}.cluster.json -trap "rm -f $aux" EXIT - -echo "{ \"nodes\": [ { \"ip\": \"$ip\" }" > $aux -for node in $nodes; do - echo ", { \"ip\": \"$node\" }" >> $aux -done -echo "], \"ipPrefix\": \"$ipPrefix.*\" }" >> $aux - -for node in $ip $nodes; do - echo "Forming cluster on $node..." - curl --user $user:$password -X POST \ - http://$node:8181/onos/v1/cluster/configuration -d @$aux -done
\ No newline at end of file diff --git a/framework/src/onos/tools/package/bin/onos-jpenable b/framework/src/onos/tools/package/bin/onos-jpenable deleted file mode 100755 index 7c69602a..00000000 --- a/framework/src/onos/tools/package/bin/onos-jpenable +++ /dev/null @@ -1,7 +0,0 @@ -#!/bin/bash - -kpid=$(ps -ef | grep karaf.main.Main | grep -v grep | cut -c10-15 | tr -d ' ') - -[ -z "$kpid" ] && echo "No ONOS!" && exit 1 - -/opt/jprofiler8/bin/jpenable --gui --port=8849 --pid=$kpid diff --git a/framework/src/onos/tools/package/bin/onos-secure-ssh b/framework/src/onos/tools/package/bin/onos-secure-ssh deleted file mode 100755 index 3f541dbe..00000000 --- a/framework/src/onos/tools/package/bin/onos-secure-ssh +++ /dev/null @@ -1,38 +0,0 @@ -#!/bin/bash -# ----------------------------------------------------------------------------- -# Enables secure access to ONOS console by removing default users & keys. -# ----------------------------------------------------------------------------- - -rm -f $(dirname $0)/onos - -set -e - -# Scan arguments for user/password or other options... -while getopts u:p: o; do - case "$o" in - u) user=$OPTARG;; - p) password=$OPTARG;; - esac -done -password=${password:-$user} # password defaults to the user if not specified -let OPC=$OPTIND-1 -shift $OPC - -cd $(dirname $0)/../apache-karaf-*/etc -USERS=users.properties -KEYS=keys.properties - -# Remove the built-in users and keys to secure the access implicitly. -egrep -v "^(karaf|onos)[ ]*=" $USERS > $USERS.new && mv $USERS.new $USERS -egrep -v "^(#karaf|onos)[ ]*=" $KEYS > $KEYS.new && mv $KEYS.new $KEYS - -# Remove any previous known keys for the local host. -ssh-keygen -f "$HOME/.ssh/known_hosts" -R [localhost]:8101 - -# Swap the onos client to use the SSH variant. -ln -s $(dirname $0)/onos-ssh $(dirname $0)/onos - -# If user and password options were given, setup the user/password. -if [ -n "$user" -a -n "$password" ]; then - echo "$user = $password,_g_:admingroup" >> $USERS -fi
\ No newline at end of file diff --git a/framework/src/onos/tools/package/bin/onos-service b/framework/src/onos/tools/package/bin/onos-service deleted file mode 100755 index 2f00ca02..00000000 --- a/framework/src/onos/tools/package/bin/onos-service +++ /dev/null @@ -1,44 +0,0 @@ -#!/bin/bash -# ----------------------------------------------------------------------------- -# Starts ONOS Apache Karaf container -# ----------------------------------------------------------------------------- - -# uncomment the following line for performance testing -#export JAVA_OPTS="${JAVA_OPTS:--Xms8G -Xmx8G -XX:+UseConcMarkSweepGC -XX:+CMSIncrementalMode -XX:+PrintGCDetails -XX:+PrintGCTimeStamps}" - -# uncomment the following line for Netty TLS encryption -# Do modify the keystore location/password and truststore location/password accordingly -#export JAVA_OPTS="${JAVA_OPTS:--DenableNettyTLS=true -Djavax.net.ssl.keyStore=/home/ubuntu/onos.jks -Djavax.net.ssl.keyStorePassword=222222 -Djavax.net.ssl.trustStore=/home/ubuntu/onos.jks -Djavax.net.ssl.trustStorePassword=222222}" - -ONOS_HOME=/opt/onos -KARAF_ARGS= -SYS_APPS=drivers - -[ -d $ONOS_HOME ] && cd $ONOS_HOME || ONOS_HOME=$(dirname $0)/.. - -# Parse out arguments destinted for karaf invocation v. arguments that -# will be processed in line -while [ $# -gt 0 ]; do - case $1 in - apps-clean) - # Deactivate all applications - find ${ONOS_HOME}/apps -name "active" -exec rm \{\} \; - ;; - *) - KARAF_ARGS+=" $1" - ;; - esac - shift -done - -# Activate the system required applications (SYS_APPS) as well as any -# specified applications in the var ONOS_APPS -for app in ${SYS_APPS//,/ } ${ONOS_APPS//,/ }; do - if [[ "$app" =~ \. ]]; then - touch ${ONOS_HOME}/apps/$app/active - else - touch ${ONOS_HOME}/apps/org.onosproject.$app/active - fi -done - -exec ${ONOS_HOME}/apache-karaf-$KARAF_VERSION/bin/karaf $KARAF_ARGS diff --git a/framework/src/onos/tools/package/bin/onos-ssh b/framework/src/onos/tools/package/bin/onos-ssh deleted file mode 100755 index 7e082aa5..00000000 --- a/framework/src/onos/tools/package/bin/onos-ssh +++ /dev/null @@ -1,6 +0,0 @@ -#!/bin/bash -# ----------------------------------------------------------------------------- -# ONOS command-line client that uses raw ssh. -# ----------------------------------------------------------------------------- - -ssh -p 8101 localhost "$@"
\ No newline at end of file diff --git a/framework/src/onos/tools/package/bin/onos-user-key b/framework/src/onos/tools/package/bin/onos-user-key deleted file mode 100755 index db24da17..00000000 --- a/framework/src/onos/tools/package/bin/onos-user-key +++ /dev/null @@ -1,20 +0,0 @@ -#!/bin/bash -# ----------------------------------------------------------------------------- -# Adds or removes a user key for managing passwordless loging to ONOS console. -# ----------------------------------------------------------------------------- - -[ $# -lt 2 ] && echo "usage: $(basename $0) user {key|remove}" && exit 1 - -set -e - -user=$1 -[ -f $2 ] && key=$(cut -d\ -f2 $2) || key=$2 - -cd $(dirname $0)/../apache-karaf-*/etc -KEYS=keys.properties - -# Remove the user key first, in case one was already present -egrep -v "^$user[ ]*=" $KEYS > $KEYS.new && mv $KEYS.new $KEYS -if [ $key != "remove" ]; then - echo "$user=$key,_g_:admingroup" >> $KEYS -fi diff --git a/framework/src/onos/tools/package/branding/pom.xml b/framework/src/onos/tools/package/branding/pom.xml deleted file mode 100644 index 77ff7cde..00000000 --- a/framework/src/onos/tools/package/branding/pom.xml +++ /dev/null @@ -1,53 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!-- - ~ Copyright 2014 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. - --> -<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> - - <modelVersion>4.0.0</modelVersion> - - <parent> - <groupId>org.onosproject</groupId> - <artifactId>onos</artifactId> - <version>1.4.0-rc1</version> - <relativePath>../../../pom.xml</relativePath> - </parent> - - <artifactId>onos-branding</artifactId> - <packaging>bundle</packaging> - <description>Custom Karaf CLI motd</description> - <build> - <plugins> - <plugin> - <groupId>org.apache.felix</groupId> - <artifactId>maven-bundle-plugin</artifactId> - <extensions>true</extensions> - <configuration> - <instructions> - <Bundle-SymbolicName>manual</Bundle-SymbolicName> - <Import-Package>*</Import-Package> - <Private-Package>!*</Private-Package> - <Export-Package> - org.apache.karaf.branding - </Export-Package> - <Spring-Context>*;public-context:=false</Spring-Context> - </instructions> - </configuration> - </plugin> - </plugins> - </build> - -</project> - diff --git a/framework/src/onos/tools/package/branding/src/main/resources/org/apache/karaf/branding/branding.properties b/framework/src/onos/tools/package/branding/src/main/resources/org/apache/karaf/branding/branding.properties deleted file mode 100644 index 7a9f9f2d..00000000 --- a/framework/src/onos/tools/package/branding/src/main/resources/org/apache/karaf/branding/branding.properties +++ /dev/null @@ -1,26 +0,0 @@ -# -# Copyright 2014 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. -# -welcome = Welcome to Open Network Operating System (ONOS)!\r\n\ -\u001B[1;31m ____ _ ______ ____ \u001B[0m\r\n\ -\u001B[1;31m / __ \\/ |/ / __ \\/ __/ \u001B[0m\r\n\ -\u001B[1;31m / /_/ / / /_/ /\\ \\ \u001B[0m\r\n\ -\u001B[1;31m \\____/_/|_/\\____/___/ \u001B[0m\r\n\ -\u001B[1;31m \u001B[0m\r\n\ - \r\n\ - Hit '\u001B[1m<tab>\u001B[0m' for a list of available commands\r\n\ - and '\u001B[1m[cmd] --help\u001B[0m' for help on a specific command.\r\n\ - Hit '\u001B[1m<ctrl-d>\u001B[0m' or type '\u001B[1msystem:shutdown\u001B[0m' or '\u001B[1mlogout\u001B[0m' to shutdown ONOS.\r\n -prompt = \u001B[32monos> \u001B[0m diff --git a/framework/src/onos/tools/package/config/README b/framework/src/onos/tools/package/config/README deleted file mode 100644 index 970f87a5..00000000 --- a/framework/src/onos/tools/package/config/README +++ /dev/null @@ -1,2 +0,0 @@ -The onos-config command will copy files contained in this directory to ONOS -instances according to cell definition. diff --git a/framework/src/onos/tools/package/config/samples/component-cfg.json b/framework/src/onos/tools/package/config/samples/component-cfg.json deleted file mode 100644 index f1168e44..00000000 --- a/framework/src/onos/tools/package/config/samples/component-cfg.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "org.onosproject.proxyarp.ProxyArp": { - "ipv6NeighborDiscovery": true - } -}
\ No newline at end of file diff --git a/framework/src/onos/tools/package/config/samples/network-cfg-linkdiscovery.json b/framework/src/onos/tools/package/config/samples/network-cfg-linkdiscovery.json deleted file mode 100644 index fcc805f9..00000000 --- a/framework/src/onos/tools/package/config/samples/network-cfg-linkdiscovery.json +++ /dev/null @@ -1,35 +0,0 @@ -{ - "ports": { - "of:0000000000000002/3": { - "linkDiscovery": { - "enabled": false - } - }, - "of:0000000000000002/2": { - "linkDiscovery": { - "enabled": false - } - } - }, - "devices": { - "of:0000000000000001": { - "linkDiscovery": { - "enabled": false - } - } - }, - "apps": { - "org.onosproject.provider.lldp": { - "suppression": { - "deviceTypes": [ - "ROADM" - ], - "annotation": { - "no-lldp": null, - "sendLLDP": "false" - } - } - } - } -} - diff --git a/framework/src/onos/tools/package/config/samples/network-cfg.json b/framework/src/onos/tools/package/config/samples/network-cfg.json deleted file mode 100644 index f6879f07..00000000 --- a/framework/src/onos/tools/package/config/samples/network-cfg.json +++ /dev/null @@ -1,86 +0,0 @@ -{ - "ports" : { - "of:0000000000000002/1" : { - "interfaces" : [ - { - "ips" : [ "192.168.10.101/24" ], - "mac" : "08:9e:01:82:38:68", - "vlan" : "100" - } - ] - }, - "of:0000000000000002/2" : { - "interfaces" : [ - { - "ips" : [ "192.168.20.101/24" ], - "mac" : "08:9e:01:82:38:68", - "vlan" : "200" - } - ] - } - }, - "devices" : { - "of:0000000000000002" : { - "segmentrouting" : { - "name" : "Leaf-R1", - "nodeSid" : 101, - "routerIp" : "10.0.1.254", - "routerMac" : "00:00:00:00:01:80", - "isEdgeRouter" : true, - "adjacencySids" : [ - { "adjSids" : 100, "ports" : [2, 3] }, - { "adjSids" : 200, "ports" : [4, 5] } - ] - } - }, - "of:0000000000000191" : { - "segmentrouting" : { - "name" : "Spine-R1", - "nodeSid" : 105, - "routerIp" : "192.168.0.11", - "routerMac" : "00:00:01:00:11:80", - "isEdgeRouter" : false, - "adjacencySids" : [] - } - } - }, - "apps" : { - "org.onosproject.router" : { - "bgp" : { - "bgpSpeakers" : [ - { - "connectPoint" : "of:00000000000000aa/10", - "peers" : [ - "192.168.10.1" - ] - }, - { - "connectPoint" : "of:00000000000000aa/20", - "peers" : [ - "192.168.20.1" - ] - } - ] - } - } - }, - "hosts" : { - "00:00:00:00:00:01/4093": { - "basic": { - "ips": [ - "10.0.1.1" - ], - "location": "of:0000000000000001/3" - } - }, - "00:00:00:00:00:02/4093": { - "basic": { - "ips": [ - "10.0.1.2" - ], - "location": "of:0000000000000001/4" - } - } - } -} - diff --git a/framework/src/onos/tools/package/deb/control b/framework/src/onos/tools/package/deb/control deleted file mode 100644 index c581ac25..00000000 --- a/framework/src/onos/tools/package/deb/control +++ /dev/null @@ -1,8 +0,0 @@ -Package: onos -Architecture: all -Maintainer: ONOS Project -Depends: debconf (>= 0.5.00), default-jre-headless (>= 1.8) | openjdk-8-jre | oracle-java8-installer -Priority: optional -Version: @ONOS_POM_VERSION -Description: Open Network Operating System (ONOS) - Open Network Operating System (ONOS) is an opensource SDN controller. diff --git a/framework/src/onos/tools/package/deb/copyright b/framework/src/onos/tools/package/deb/copyright deleted file mode 100644 index 09ec05e3..00000000 --- a/framework/src/onos/tools/package/deb/copyright +++ /dev/null @@ -1,20 +0,0 @@ -Upstream-Name: onos -Source: http://github.com/opennetworkinglab/onos - -Files: * -Copyright: 2014-2015 Open Networking Laboratory -License: Apache 2.0 - 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. - . - On Debian systems, the complete text of the Apache License 2.0 can - be found in "/usr/share/common-licenses/Apache-2.0" diff --git a/framework/src/onos/tools/package/deb/postinst b/framework/src/onos/tools/package/deb/postinst deleted file mode 100755 index 60de14a7..00000000 --- a/framework/src/onos/tools/package/deb/postinst +++ /dev/null @@ -1,16 +0,0 @@ -#!/bin/bash - -ONOS_USER=sdn - -# Check to see if user exists, and if not, create a service account -getent passwd $ONOS_USER >/dev/null 2&>1 || ( useradd -M $ONOS_USER && usermod -L $ONOS_USER ) - -# Create ONOS options file -[ ! -f /opt/onos/options ] && cat << EOF > /opt/onos/options -export ONOS_OPTS=server -export ONOS_USER="$ONOS_USER" -EOF - -# Change permissions for onos directory -[ -d /opt/onos ] && chown -R $ONOS_USER.$ONOS_USER /opt/onos - diff --git a/framework/src/onos/tools/package/deb/postrm b/framework/src/onos/tools/package/deb/postrm deleted file mode 100755 index 90dd6164..00000000 --- a/framework/src/onos/tools/package/deb/postrm +++ /dev/null @@ -1,5 +0,0 @@ -#!/bin/bash - -# FIXME dpkg will remove /opt if it is empty after removing onos -# We should recreate /opt if it was deleted. -sudo mkdir -p /opt diff --git a/framework/src/onos/tools/package/deb/prerm b/framework/src/onos/tools/package/deb/prerm deleted file mode 100755 index 2a1633da..00000000 --- a/framework/src/onos/tools/package/deb/prerm +++ /dev/null @@ -1,23 +0,0 @@ -#!/bin/bash - -# Check if onos is running; if it is, stop onos -[ -z "$(status onos 2>/dev/null | grep start)" ] && echo "onos is not running." || ( - stop onos - - # Wait for onos to stop up to 5 seconds - for i in $(seq 1 5); do - [ -z "$(ps -ef | grep karaf.jar | grep -v grep)" ] && break - sleep 1 - done - [ -z "$(ps -ef | grep karaf.jar | grep -v grep)" ] && echo 'Stopped onos service' || echo 'Failed to stop onos' -) - -# Clean up onos runtime directories -# TODO don't hardcode karaf version -rm -rf /opt/onos/apache-karaf-3.0.3/ -rm -rf /opt/onos/var/* -rm -rf /opt/onos/config -rm -rf /opt/onos/options -rm -rf /opt/onos/log - -#TODO consider removing the sdn user if we created it diff --git a/framework/src/onos/tools/package/etc/org.ops4j.pax.url.mvn.cfg b/framework/src/onos/tools/package/etc/org.ops4j.pax.url.mvn.cfg deleted file mode 100644 index 15167a3b..00000000 --- a/framework/src/onos/tools/package/etc/org.ops4j.pax.url.mvn.cfg +++ /dev/null @@ -1,101 +0,0 @@ -################################################################################ -# -# Licensed to the Apache Software Foundation (ASF) under one or more -# contributor license agreements. See the NOTICE file distributed with -# this work for additional information regarding copyright ownership. -# The ASF licenses this file to You 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. -# -################################################################################ - -# -# If set to true, the following property will not allow any certificate to be used -# when accessing Maven repositories through SSL -# -#org.ops4j.pax.url.mvn.certificateCheck= - -# -# Path to the local Maven settings file. -# The repositories defined in this file will be automatically added to the list -# of default repositories if the 'org.ops4j.pax.url.mvn.repositories' property -# below is not set. -# The following locations are checked for the existence of the settings.xml file -# * 1. looks for the specified url -# * 2. if not found looks for ${user.home}/.m2/settings.xml -# * 3. if not found looks for ${maven.home}/conf/settings.xml -# * 4. if not found looks for ${M2_HOME}/conf/settings.xml -# -#org.ops4j.pax.url.mvn.settings= - -# -# Path to the local Maven repository which is used to avoid downloading -# artifacts when they already exist locally. -# The value of this property will be extracted from the settings.xml file -# above, or defaulted to: -# System.getProperty( "user.home" ) + "/.m2/repository" -# -#org.ops4j.pax.url.mvn.localRepository= - -# -# Default this to false. It's just weird to use undocumented repos -# -org.ops4j.pax.url.mvn.useFallbackRepositories=false - -# -# Uncomment if you don't wanna use the proxy settings -# from the Maven conf/settings.xml file -# -# org.ops4j.pax.url.mvn.proxySupport=false - -# -# Comma separated list of repositories scanned when resolving an artifact. -# Those repositories will be checked before iterating through the -# below list of repositories and even before the local repository -# A repository url can be appended with zero or more of the following flags: -# @snapshots : the repository contains snaphots -# @noreleases : the repository does not contain any released artifacts -# -# The following property value will add the system folder as a repo. -# -org.ops4j.pax.url.mvn.defaultRepositories=\ - file:${karaf.home}/${karaf.default.repository}@id=system.repository@snapshots,\ - file:${karaf.data}/kar@id=kar.repository@multi@snapshots - -# Use the default local repo (e.g.~/.m2/repository) as a "remote" repo -#org.ops4j.pax.url.mvn.defaultLocalRepoAsRemote=false - -# -# Comma separated list of repositories scanned when resolving an artifact. -# The default list includes the following repositories: -# http://repo1.maven.org/maven2@id=central -# http://repository.springsource.com/maven/bundles/release@id=spring.ebr -# http://repository.springsource.com/maven/bundles/external@id=spring.ebr.external -# http://zodiac.springsource.com/maven/bundles/release@id=gemini -# http://repository.apache.org/content/groups/snapshots-group@id=apache@snapshots@noreleases -# https://oss.sonatype.org/content/repositories/snapshots@id=sonatype.snapshots.deploy@snapshots@noreleases -# https://oss.sonatype.org/content/repositories/ops4j-snapshots@id=ops4j.sonatype.snapshots.deploy@snapshots@noreleases -# To add repositories to the default ones, prepend '+' to the list of repositories -# to add. -# A repository url can be appended with zero or more of the following flags: -# @snapshots : the repository contains snapshots -# @noreleases : the repository does not contain any released artifacts -# @id=repository.id : the id for the repository, just like in the settings.xml this is optional but recommended -# -org.ops4j.pax.url.mvn.repositories= \ - ${org.ops4j.pax.url.mvn.defaultRepositories}, \ - http://repo1.maven.org/maven2@id=central, \ - http://repository.springsource.com/maven/bundles/release@id=spring.ebr.release, \ - http://repository.springsource.com/maven/bundles/external@id=spring.ebr.external, \ - http://zodiac.springsource.com/maven/bundles/release@id=gemini, \ - http://repository.apache.org/content/groups/snapshots-group@id=apache@snapshots@noreleases, \ - https://oss.sonatype.org/content/repositories/snapshots@id=sonatype.snapshots.deploy@snapshots@noreleases, \ - https://oss.sonatype.org/content/repositories/ops4j-snapshots@id=ops4j.sonatype.snapshots.deploy@snapshots@noreleases diff --git a/framework/src/onos/tools/package/etc/org.ops4j.pax.web.cfg b/framework/src/onos/tools/package/etc/org.ops4j.pax.web.cfg deleted file mode 100644 index c8fb3b3d..00000000 --- a/framework/src/onos/tools/package/etc/org.ops4j.pax.web.cfg +++ /dev/null @@ -1,12 +0,0 @@ -org.osgi.service.http.port=8181 -org.osgi.service.http.port.secure=8443 - -org.osgi.service.http.enabled=true -org.osgi.service.http.secure.enabled=false - -org.ops4j.pax.web.ssl.keystore=etc/keystore -org.ops4j.pax.web.ssl.password=OBF:1xtn1w1u1uob1xtv1y7z1xtn1unn1w1o1xtv -org.ops4j.pax.web.ssl.keypassword=OBF:1xtn1w1u1uob1xtv1y7z1xtn1unn1w1o1xtv - -org.ops4j.pax.web.session.url=none -org.ops4j.pax.web.config.file=./etc/jetty.xml diff --git a/framework/src/onos/tools/package/etc/samples/linkGraph.cfg b/framework/src/onos/tools/package/etc/samples/linkGraph.cfg deleted file mode 100644 index 41ce5bdc..00000000 --- a/framework/src/onos/tools/package/etc/samples/linkGraph.cfg +++ /dev/null @@ -1,27 +0,0 @@ -# NullLinkProvider topology description (config file). -# -# Dot-style topology graph. Each controller's topology begins with -# -# graph <node ID>, followed by a list of links between braces. -# -# The links are either bidirectional (--) or directed (->). The directed -# edges are used to connect together Null devices of different controllers. -# The endpoint has the format: -# -# devID:port:NodeId -# -# The NodeId is only added if the destination is another node's device. -# -graph 192.168.56.20 { - 0:0 -- 1:0 - 1:1 -> 0:0:192.168.56.30 - 1:2 -- 2:0 - 2:1 -> 1:0:192.168.56.30 -} -graph 192.168.56.30 { - 0:0 -> 1:1:192.168.56.20 - 0:1 -- 1:1 - 1:0 -> 2:1:192.168.56.20 - 1:2 -- 2:0 -} -# Bugs: Comments cannot be appended to a line to be read. diff --git a/framework/src/onos/tools/package/etc/samples/org.onosproject.faultmanagement.impl.AlarmsManager.cfg b/framework/src/onos/tools/package/etc/samples/org.onosproject.faultmanagement.impl.AlarmsManager.cfg deleted file mode 100644 index 99795e57..00000000 --- a/framework/src/onos/tools/package/etc/samples/org.onosproject.faultmanagement.impl.AlarmsManager.cfg +++ /dev/null @@ -1,6 +0,0 @@ -# -# devices which may have faults. -# TODO change to NetworkConfig subsystem. -# -fmDevices = 172.27.7.110,172.27.7.110,3.3.3.3 - diff --git a/framework/src/onos/tools/package/etc/samples/org.onosproject.fwd.ReactiveForwarding.cfg b/framework/src/onos/tools/package/etc/samples/org.onosproject.fwd.ReactiveForwarding.cfg deleted file mode 100644 index 4befc706..00000000 --- a/framework/src/onos/tools/package/etc/samples/org.onosproject.fwd.ReactiveForwarding.cfg +++ /dev/null @@ -1,79 +0,0 @@ -# -# Sample configuration for onos-app-fwd. -# - -# -# Reactive flows default matching is InPort, Src MAC, Dst MAC and EtherType fields -# - -# -# Enable packet-out only forwarding. -# This flag affects to both IPv4 and IPv6. -# -# packetOutOnly = true - -# -# Enable forwarding of the first packet by using OFPP_TABLE port in the -# PacketOut message instead of sending it directly to the switch port -# -# packetOutOfppTable = true - -# -# Timeout of reactively installed flows (in seconds). -# Default is 10 sec -# -# flowTimeout = 10 - -# -# Priority of reactively installed flows -# -# flowPriority = 10 - -# -# Enable IPv6 forwarding. -# -# ipv6Forwarding = true - -# -# Flows matching destination MAC only - as legacy L2 switches -# - This option overrides all other options below -# -# matchDstMacOnly = true - -# -# Matching of VLAN ID in Ethernet header -# -# matchVlanId = true - -# -# Matching of IPv4 addresses and Protocol field -# - must be enabled to match IPv4 DSCP, TCP/UDP ports and ICMP type/code -# -# matchIpv4Address = true - -# -# Matching of IPv4 DSCP and ECN fields -# -# matchIpv4Dscp = true - -# -# Matching of IPv6 addresses and Next-Header field -# - must be enabled to match IPv6 Flow Label, TCP/UDP ports and ICMP type/code -# -# matchIpv6Address = true - -# -# Matching of IPv6 Flow Label -# -# matchIpv6FlowLabel = true - -# -# Matching of TCP/UDP ports for IPv4 and IPv6 -# -# matchTcpUdpPorts = true - -# -# Matching of ICMP Type and Code fields for IPv4 and IPv6 -# -# matchIcmpFields = true - diff --git a/framework/src/onos/tools/package/etc/samples/org.onosproject.provider.host.impl.HostLocationProvider.cfg b/framework/src/onos/tools/package/etc/samples/org.onosproject.provider.host.impl.HostLocationProvider.cfg deleted file mode 100644 index 6d3a50d9..00000000 --- a/framework/src/onos/tools/package/etc/samples/org.onosproject.provider.host.impl.HostLocationProvider.cfg +++ /dev/null @@ -1,13 +0,0 @@ -# -# Sample configuration for Host Location Provider -# - -# -# Enable host removal on port/device down events. -# -# hostRemovalEnabled = true - -# -# Enable using IPv6 Neighbor Discovery by the Host Location Provider. -# -# ipv6NeighborDiscovery = true diff --git a/framework/src/onos/tools/package/etc/samples/org.onosproject.provider.lldp.impl.LLDPLinkProvider.cfg b/framework/src/onos/tools/package/etc/samples/org.onosproject.provider.lldp.impl.LLDPLinkProvider.cfg deleted file mode 100644 index 6eb39a11..00000000 --- a/framework/src/onos/tools/package/etc/samples/org.onosproject.provider.lldp.impl.LLDPLinkProvider.cfg +++ /dev/null @@ -1,21 +0,0 @@ -# -# Sample configuration for link discovery -# - -# -# Disable Link Dicovery Permanently (Note: changing this property at runtime will have NO effect) -# WARNING: This should only be used for special projects like bgprouter, where ONOS is controlling -# a single switch -# -#disableLinkDiscovery = true - -# -# Enable Broadcast Discovery Protocol (EthType=0x8942) -# -#useBDDP = false - -# -# Disable LLDP's received from specific devices -# Details of the devices are in the file configured below -# -#lldpSuppression = ../config/lldp_suppresion.json diff --git a/framework/src/onos/tools/package/etc/samples/org.onosproject.provider.netconf.device.impl.NetconfDeviceProvider.cfg b/framework/src/onos/tools/package/etc/samples/org.onosproject.provider.netconf.device.impl.NetconfDeviceProvider.cfg deleted file mode 100644 index 30ed0c26..00000000 --- a/framework/src/onos/tools/package/etc/samples/org.onosproject.provider.netconf.device.impl.NetconfDeviceProvider.cfg +++ /dev/null @@ -1,11 +0,0 @@ -# -# Instance-specific configurations, in this case, the number of -# devices per node. -# -devConfigs = cisco:cisco@192.168.56.20:2022:inactive,sdn:rocks@192.168.56.30:22:inactive - -# -# Number of ports per device. This is global to all devices -# on all instances. -# -# numPorts = 8 diff --git a/framework/src/onos/tools/package/etc/samples/org.onosproject.provider.nil.device.impl.NullDeviceProvider.cfg b/framework/src/onos/tools/package/etc/samples/org.onosproject.provider.nil.device.impl.NullDeviceProvider.cfg deleted file mode 100644 index 194bf037..00000000 --- a/framework/src/onos/tools/package/etc/samples/org.onosproject.provider.nil.device.impl.NullDeviceProvider.cfg +++ /dev/null @@ -1,11 +0,0 @@ -# -# Instance-specific configurations, in this case, the number of -# devices per node. -# -devConfigs = 192.168.56.20:3,192.168.56.30:3 - -# -# Number of ports per device. This is global to all devices -# on all instances. -# -# numPorts = 8 diff --git a/framework/src/onos/tools/package/etc/samples/org.onosproject.provider.nil.link.impl.NullLinkProvider.cfg b/framework/src/onos/tools/package/etc/samples/org.onosproject.provider.nil.link.impl.NullLinkProvider.cfg deleted file mode 100644 index ef72b1ee..00000000 --- a/framework/src/onos/tools/package/etc/samples/org.onosproject.provider.nil.link.impl.NullLinkProvider.cfg +++ /dev/null @@ -1,16 +0,0 @@ -# -# Sample configurations for the NullLinkProvider. -# - -# -# If enabled, sets the time between LinkEvent generation, -# in microseconds. -# - -#eventRate = 1000000 - -# -# If enabled, points to the full path to the topology file. -# - -#cfgFile = /tmp/foo.cfg diff --git a/framework/src/onos/tools/package/etc/samples/org.onosproject.provider.nil.packet.impl.NullPacketProvider.cfg b/framework/src/onos/tools/package/etc/samples/org.onosproject.provider.nil.packet.impl.NullPacketProvider.cfg deleted file mode 100644 index db4342c0..00000000 --- a/framework/src/onos/tools/package/etc/samples/org.onosproject.provider.nil.packet.impl.NullPacketProvider.cfg +++ /dev/null @@ -1,4 +0,0 @@ -# -# Uncomment and tweak to tune the rate of Packet events (per second) -# -# pktRate = 100 diff --git a/framework/src/onos/tools/package/etc/samples/org.onosproject.proxyarp.ProxyArp.cfg b/framework/src/onos/tools/package/etc/samples/org.onosproject.proxyarp.ProxyArp.cfg deleted file mode 100644 index 108de136..00000000 --- a/framework/src/onos/tools/package/etc/samples/org.onosproject.proxyarp.ProxyArp.cfg +++ /dev/null @@ -1,8 +0,0 @@ -# -# Sample configuration for onos-app-proxyarp. -# - -# -# Enable IPv6 Neighbor Discovery. -# -# ipv6NeighborDiscovery = true diff --git a/framework/src/onos/tools/package/etc/samples/org.onosproject.routing.bgp.BgpSessionManager.cfg b/framework/src/onos/tools/package/etc/samples/org.onosproject.routing.bgp.BgpSessionManager.cfg deleted file mode 100644 index fbcc13f9..00000000 --- a/framework/src/onos/tools/package/etc/samples/org.onosproject.routing.bgp.BgpSessionManager.cfg +++ /dev/null @@ -1,8 +0,0 @@ -# -# Sample configuration for onos-app-sdnip. -# - -# -# The port number that SDN-IP listens for incoming BGP connections on. -# -# bgpPort=2000
\ No newline at end of file diff --git a/framework/src/onos/tools/package/etc/samples/org.onosproject.xos.XOS.cfg b/framework/src/onos/tools/package/etc/samples/org.onosproject.xos.XOS.cfg deleted file mode 100644 index e69de29b..00000000 --- a/framework/src/onos/tools/package/etc/samples/org.onosproject.xos.XOS.cfg +++ /dev/null diff --git a/framework/src/onos/tools/package/etc/users.properties b/framework/src/onos/tools/package/etc/users.properties deleted file mode 100644 index 9f7a2667..00000000 --- a/framework/src/onos/tools/package/etc/users.properties +++ /dev/null @@ -1,34 +0,0 @@ -################################################################################ -# -# Licensed to the Apache Software Foundation (ASF) under one or more -# contributor license agreements. See the NOTICE file distributed with -# this work for additional information regarding copyright ownership. -# The ASF licenses this file to You 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. -# -################################################################################ - -# -# This file contains the users, groups, and roles. -# Each line has to be of the format: -# -# USER=PASSWORD,ROLE1,ROLE2,... -# USER=PASSWORD,_g_:GROUP,... -# _g_\:GROUP=ROLE1,ROLE2,... -# -# All users, grousp, and roles entered in this file are available after Karaf startup -# and modifiable via the JAAS command group. These users reside in a JAAS domain -# with the name "karaf". -# -karaf = karaf,_g_:admingroup -onos = rocks,_g_:admingroup -_g_\:admingroup = group,admin,manager,viewer,webconsole diff --git a/framework/src/onos/tools/package/init/onos.conf b/framework/src/onos/tools/package/init/onos.conf deleted file mode 100644 index 779df905..00000000 --- a/framework/src/onos/tools/package/init/onos.conf +++ /dev/null @@ -1,37 +0,0 @@ -description "Open Network Operating System" -author "ON.Lab" - -start on (net-device-up - and local-filesystems - and runlevel [2345]) -stop on runlevel [016] - -console output -kill timeout 60 -respawn - -env LANG=en_US.UTF-8 - -pre-start script - [ -f /opt/onos/options ] && . /opt/onos/options - ONOS_USER=${ONOS_USER:-root} - - # Ensure that the environment is initialized - [ -d /opt/onos ] && mkdir /opt/onos/var 2>/dev/null && chown $ONOS_USER.$ONOS_USER /opt/onos/var - [ -d /opt/onos ] && mkdir /opt/onos/config 2>/dev/null && chown $ONOS_USER.$ONOS_USER /opt/onos/config - # TODO make karaf version configurable - [ -d /opt/onos ] && [ ! -h /opt/onos/log ] \ - && ln -s /opt/onos/apache-karaf-3.0.3/data/log /opt/onos/log || : -end script - -pre-stop script - /opt/onos/bin/onos halt 2>>/opt/onos/var/stderr.log - sleep 1 -end script - -script - [ -f /opt/onos/options ] && . /opt/onos/options - start-stop-daemon --signal INT --start --chuid ${ONOS_USER:-root} \ - --exec /opt/onos/bin/onos-service -- ${ONOS_OPTS:-server} \ - >/opt/onos/var/stdout.log 2>/opt/onos/var/stderr.log -end script diff --git a/framework/src/onos/tools/package/karaf-assembly/onos-assembly.py b/framework/src/onos/tools/package/karaf-assembly/onos-assembly.py deleted file mode 100755 index 1e394bf6..00000000 --- a/framework/src/onos/tools/package/karaf-assembly/onos-assembly.py +++ /dev/null @@ -1,80 +0,0 @@ -#!/usr/bin/env python -''' - Builds synthetic feature file that includes all core, provider, and application - features, so that we can pre-stage all bundles required to run ONOS off-line. -''' - -import os -import xml.etree.ElementTree as ET - -FEATURE_TAG = '{http://karaf.apache.org/xmlns/features/v1.2.0}feature' -STAGED_REPOS = 'target/staged-repos.xml' - -if 'ONOS_ROOT' in os.environ: - ONOS_ROOT = os.environ['ONOS_ROOT'] -else: - # fallback to working directory if ONOS_ROOT is not set - ONOS_ROOT = os.getcwd() - -def findFeatureFiles(path=ONOS_ROOT): - #only descend into target directories that have pom - for root, dirs, files in os.walk(path): - if 'pom.xml' not in files: - if 'target' in dirs: - #pruning target dir with no pom.xml - dirs.remove('target') - if '/target' in root: - if '/classes/' in root: - #filter out features.xml for maven-plugin - continue - for f in files: - if f.endswith('features.xml'): - yield os.path.join(root, f) - -def featuresFromFile(file): - features = [] - tree = ET.parse(file) - root = tree.getroot() - for feature in root.findall(FEATURE_TAG): - features.append(feature.attrib['name']) - return features - -if __name__ == '__main__': - outputTree = ET.Element('features') - uberFeature = ET.Element('feature', attrib={'name' : 'onos-uber-synthetic'}) - for file in findFeatureFiles(): - features = featuresFromFile(file) - if len(features) > 0: - ET.SubElement(outputTree, 'repository').text = 'file:%s' % file - for feature in features: - ET.SubElement(uberFeature, 'feature').text = feature - outputTree.append(uberFeature) - - outputFile = os.path.join(os.path.dirname(os.path.realpath(__file__)), STAGED_REPOS) - outputDir = os.path.dirname(outputFile) - if not os.path.exists(outputDir): - os.mkdir(outputDir) - ET.ElementTree(outputTree).write(outputFile) - - import sys - if '-d' in sys.argv: - # -------- TODO for debug only -------- - def indent(elem, level=0): - #function borrowed from: http://effbot.org/zone/element-lib.htm#prettyprint - i = "\n" + level*" " - if len(elem): - if not elem.text or not elem.text.strip(): - elem.text = i + " " - if not elem.tail or not elem.tail.strip(): - elem.tail = i - for elem in elem: - indent(elem, level+1) - if not elem.tail or not elem.tail.strip(): - elem.tail = i - else: - if level and (not elem.tail or not elem.tail.strip()): - elem.tail = i - - print 'Writing to file:', outputFile - indent(outputTree) - ET.dump(outputTree) diff --git a/framework/src/onos/tools/package/karaf-assembly/pom.xml b/framework/src/onos/tools/package/karaf-assembly/pom.xml deleted file mode 100644 index 4b47c0d1..00000000 --- a/framework/src/onos/tools/package/karaf-assembly/pom.xml +++ /dev/null @@ -1,84 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> - -<!-- - ~ Copyright 2014-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. - --> -<project xmlns="http://maven.apache.org/POM/4.0.0" - xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> - <modelVersion>4.0.0</modelVersion> - - <parent> - <groupId>org.onosproject</groupId> - <artifactId>onos-base</artifactId> - <version>1</version> - </parent> - - <groupId>org.onosproject</groupId> - <artifactId>onos-assembly</artifactId> - <version>1.0</version> - <packaging>pom</packaging> - - <description>ONOS Apache Karaf assembly definitions</description> - - <build> - <plugins> - <plugin> - <artifactId>maven-antrun-plugin</artifactId> - <version>1.8</version> - <executions> - <execution> - <phase>generate-sources</phase> - <configuration> - <target> - <exec executable="python"> - <arg value="${basedir}/onos-assembly.py"/> - </exec> - </target> - </configuration> - <goals> - <goal>run</goal> - </goals> - </execution> - </executions> - </plugin> - <plugin> - <groupId>org.apache.karaf.tooling</groupId> - <artifactId>karaf-maven-plugin</artifactId> - <version>3.0.3</version> - - <executions> - <execution> - <id>features-add-to-repo</id> - <phase>generate-resources</phase> - <goals> - <goal>features-add-to-repository</goal> - </goals> - <configuration> - <descriptors> - <descriptor>file:${basedir}/target/staged-repos.xml</descriptor> - </descriptors> - <features> - <feature>onos-uber-synthetic</feature> - </features> - <repository>target/repo</repository> - </configuration> - </execution> - </executions> - </plugin> - </plugins> - </build> - -</project> diff --git a/framework/src/onos/tools/package/maven-plugin/pom.xml b/framework/src/onos/tools/package/maven-plugin/pom.xml deleted file mode 100644 index 5a287d04..00000000 --- a/framework/src/onos/tools/package/maven-plugin/pom.xml +++ /dev/null @@ -1,128 +0,0 @@ -<!-- - ~ 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. - --> -<project> - <modelVersion>4.0.0</modelVersion> - - <parent> - <groupId>org.onosproject</groupId> - <artifactId>onos-base</artifactId> - <version>1</version> - <relativePath>../../build/pom.xml</relativePath> - </parent> - - <groupId>org.onosproject</groupId> - <artifactId>onos-maven-plugin</artifactId> - <version>1.7-SNAPSHOT</version> - <packaging>maven-plugin</packaging> - - <description>Maven plugin for packaging ONOS applications or generating - component configuration resources - </description> - - <dependencies> - <dependency> - <groupId>org.apache.maven</groupId> - <artifactId>maven-plugin-api</artifactId> - <version>2.0</version> - </dependency> - - <dependency> - <groupId>org.apache.maven</groupId> - <artifactId>maven-project</artifactId> - <version>2.0</version> - </dependency> - - <dependency> - <groupId>com.thoughtworks.qdox</groupId> - <artifactId>qdox</artifactId> - <version>2.0-M3</version> - </dependency> - - <dependency> - <groupId>com.google.guava</groupId> - <artifactId>guava</artifactId> - <version>18.0</version> - </dependency> - - <dependency> - <groupId>commons-collections</groupId> - <artifactId>commons-collections</artifactId> - <version>3.2.1</version> - </dependency> - - <dependency> - <groupId>commons-configuration</groupId> - <artifactId>commons-configuration</artifactId> - <version>1.10</version> - </dependency> - - <!-- dependencies to annotations --> - <dependency> - <groupId>org.apache.maven.plugin-tools</groupId> - <artifactId>maven-plugin-annotations</artifactId> - <version>3.4</version> - <scope>provided</scope> - </dependency> - <dependency> - <groupId>com.fasterxml.jackson.core</groupId> - <artifactId>jackson-databind</artifactId> - <version>2.4.2</version> - </dependency> - <dependency> - <groupId>com.fasterxml.jackson.core</groupId> - <artifactId>jackson-annotations</artifactId> - <version>2.4.2</version> - </dependency> - <dependency> - <groupId>commons-io</groupId> - <artifactId>commons-io</artifactId> - <version>2.4</version> - </dependency> - </dependencies> - - <build> - <plugins> - <plugin> - <groupId>org.apache.maven.plugins</groupId> - <artifactId>maven-compiler-plugin</artifactId> - <version>2.5.1</version> - <configuration> - <source>1.8</source> - <target>1.8</target> - </configuration> - </plugin> - - <plugin> - <groupId>org.apache.maven.plugins</groupId> - <artifactId>maven-plugin-plugin</artifactId> - <version>3.4</version> - <executions> - <execution> - <id>default-descriptor</id> - <phase>process-classes</phase> - </execution> - <!-- if you want to generate help goal --> - <execution> - <id>help-goal</id> - <goals> - <goal>helpmojo</goal> - </goals> - </execution> - </executions> - </plugin> - </plugins> - </build> -</project> diff --git a/framework/src/onos/tools/package/maven-plugin/src/main/java/org/onosproject/maven/OnosAppMojo.java b/framework/src/onos/tools/package/maven-plugin/src/main/java/org/onosproject/maven/OnosAppMojo.java deleted file mode 100644 index 09cf4dd9..00000000 --- a/framework/src/onos/tools/package/maven-plugin/src/main/java/org/onosproject/maven/OnosAppMojo.java +++ /dev/null @@ -1,378 +0,0 @@ -/* - * 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.maven; - -import com.google.common.collect.ImmutableList; -import org.apache.commons.configuration.ConfigurationException; -import org.apache.commons.configuration.XMLConfiguration; -import org.apache.maven.artifact.repository.ArtifactRepository; -import org.apache.maven.plugin.AbstractMojo; -import org.apache.maven.plugin.MojoExecutionException; -import org.apache.maven.plugins.annotations.Component; -import org.apache.maven.plugins.annotations.LifecyclePhase; -import org.apache.maven.plugins.annotations.Mojo; -import org.apache.maven.plugins.annotations.Parameter; -import org.apache.maven.project.MavenProject; -import org.apache.maven.project.MavenProjectHelper; - -import java.io.File; -import java.io.FileInputStream; -import java.io.FileNotFoundException; -import java.io.FileOutputStream; -import java.io.IOException; -import java.io.InputStream; -import java.util.List; -import java.util.stream.Collectors; -import java.util.zip.ZipEntry; -import java.util.zip.ZipOutputStream; - -import static com.google.common.io.ByteStreams.toByteArray; -import static org.codehaus.plexus.util.FileUtils.*; - -/** - * Produces ONOS application archive using the app.xml file information. - */ -@Mojo(name = "app", defaultPhase = LifecyclePhase.PACKAGE) -public class OnosAppMojo extends AbstractMojo { - - private static final String APP = "app"; - private static final String NAME = "[@name]"; - private static final String VERSION = "[@version]"; - private static final String FEATURES_REPO = "[@featuresRepo]"; - private static final String ARTIFACT = "artifact"; - - private static final String APP_XML = "app.xml"; - private static final String FEATURES_XML = "features.xml"; - - private static final String MVN_URL = "mvn:"; - private static final String M2_PREFIX = "m2"; - - private static final String ONOS_APP_NAME = "onos.app.name"; - private static final String ONOS_APP_ORIGIN = "onos.app.origin"; - private static final String ONOS_APP_REQUIRES = "onos.app.requires"; - - private static final String JAR = "jar"; - private static final String XML = "xml"; - private static final String APP_ZIP = "oar"; - private static final String PACKAGE_DIR = "oar"; - - private static final String DEFAULT_ORIGIN = "ON.Lab"; - private static final String DEFAULT_VERSION = "${project.version}"; - - private static final String DEFAULT_FEATURES_REPO = - "mvn:${project.groupId}/${project.artifactId}/${project.version}/xml/features"; - private static final String DEFAULT_ARTIFACT = - "mvn:${project.groupId}/${project.artifactId}/${project.version}"; - - private static final int BUFFER_SIZE = 8192; - - private String name; - private String origin; - private String requiredApps; - private String version = DEFAULT_VERSION; - private String featuresRepo = DEFAULT_FEATURES_REPO; - private List<String> artifacts; - - /** - * The project base directory. - */ - @Parameter(defaultValue = "${basedir}") - protected File baseDir; - - /** - * The directory where the generated catalogue file will be put. - */ - @Parameter(defaultValue = "${project.build.directory}") - protected File dstDirectory; - - /** - * The project group ID. - */ - @Parameter(defaultValue = "${project.groupId}") - protected String projectGroupId; - - /** - * The project artifact ID. - */ - @Parameter(defaultValue = "${project.artifactId}") - protected String projectArtifactId; - - /** - * The project version. - */ - @Parameter(defaultValue = "${project.version}") - protected String projectVersion; - - /** - * The project version. - */ - @Parameter(defaultValue = "${project.description}") - protected String projectDescription; - - @Parameter(defaultValue = "${localRepository}") - protected ArtifactRepository localRepository; - - /** - * Maven project - */ - @Parameter(defaultValue = "${project}") - protected MavenProject project; - - /** - * Maven project helper. - */ - @Component - protected MavenProjectHelper projectHelper; - - - private File m2Directory; - protected File stageDirectory; - protected String projectPath; - - @Override - public void execute() throws MojoExecutionException { - File appFile = new File(baseDir, APP_XML); - File featuresFile = new File(baseDir, FEATURES_XML); - - name = (String) project.getProperties().get(ONOS_APP_NAME); - - // If neither the app.xml file exists, nor the onos.app.name property - // is defined, there is nothing for this Mojo to do, so bail. - if (!appFile.exists() && name == null) { - return; - } - - m2Directory = new File(localRepository.getBasedir()); - stageDirectory = new File(dstDirectory, PACKAGE_DIR); - projectPath = M2_PREFIX + "/" + artifactDir(projectGroupId, projectArtifactId, projectVersion); - - origin = (String) project.getProperties().get(ONOS_APP_ORIGIN); - origin = origin != null ? origin : DEFAULT_ORIGIN; - - requiredApps = (String) project.getProperties().get(ONOS_APP_REQUIRES); - requiredApps = requiredApps == null ? "" : requiredApps.replaceAll("[\\s]", ""); - - if (appFile.exists()) { - loadAppFile(appFile); - } else { - artifacts = ImmutableList.of(eval(DEFAULT_ARTIFACT)); - } - - // If there are any artifacts, stage the - if (!artifacts.isEmpty()) { - getLog().info("Building ONOS application package for " + name + " (v" + eval(version) + ")"); - artifacts.forEach(a -> getLog().debug("Including artifact: " + a)); - - if (stageDirectory.exists() || stageDirectory.mkdirs()) { - processAppXml(appFile); - processFeaturesXml(featuresFile); - processArtifacts(); - generateAppPackage(); - } else { - throw new MojoExecutionException("Unable to create directory: " + stageDirectory); - } - } - } - - // Loads the app.xml file. - private void loadAppFile(File appFile) throws MojoExecutionException { - XMLConfiguration xml = new XMLConfiguration(); - xml.setRootElementName(APP); - - try (FileInputStream stream = new FileInputStream(appFile)) { - xml.load(stream); - xml.setAttributeSplittingDisabled(true); - xml.setDelimiterParsingDisabled(true); - - name = xml.getString(NAME); - version = eval(xml.getString(VERSION)); - featuresRepo = eval(xml.getString(FEATURES_REPO)); - - artifacts = xml.configurationsAt(ARTIFACT).stream() - .map(cfg -> eval(cfg.getRootNode().getValue().toString())) - .collect(Collectors.toList()); - - } catch (ConfigurationException e) { - throw new MojoExecutionException("Unable to parse app.xml file", e); - } catch (FileNotFoundException e) { - throw new MojoExecutionException("Unable to find app.xml file", e); - } catch (IOException e) { - throw new MojoExecutionException("Unable to read app.xml file", e); - } - } - - // Processes and stages the app.xml file. - private void processAppXml(File appFile) throws MojoExecutionException { - try { - File file = new File(stageDirectory, APP_XML); - forceMkdir(stageDirectory); - String contents; - - if (appFile.exists()) { - contents = fileRead(appFile); - } else { - byte[] bytes = toByteArray(getClass().getResourceAsStream(APP_XML)); - contents = new String(bytes); - } - fileWrite(file.getAbsolutePath(), eval(contents)); - } catch (IOException e) { - throw new MojoExecutionException("Unable to process app.xml", e); - } - } - - private void processFeaturesXml(File featuresFile) throws MojoExecutionException { - boolean specified = featuresRepo != null && featuresRepo.length() > 0; - - // If featuresRepo attribute is specified and there is a features.xml - // file present, add the features repo as an artifact - try { - if (specified && featuresFile.exists()) { - processFeaturesXml(new FileInputStream(featuresFile)); - } else if (specified) { - processFeaturesXml(getClass().getResourceAsStream(FEATURES_XML)); - } - } catch (FileNotFoundException e) { - throw new MojoExecutionException("Unable to find features.xml file", e); - } catch (IOException e) { - throw new MojoExecutionException("Unable to process features.xml file", e); - } - } - - // Processes and stages the features.xml file. - private void processFeaturesXml(InputStream stream) throws IOException { - String featuresArtifact = - artifactFile(projectArtifactId, projectVersion, XML, "features"); - File dstDir = new File(stageDirectory, projectPath); - forceMkdir(dstDir); - String s = eval(new String(toByteArray(stream))); - fileWrite(new File(dstDir, featuresArtifact).getAbsolutePath(), s); - } - - // Stages all artifacts. - private void processArtifacts() throws MojoExecutionException { - for (String artifact : artifacts) { - processArtifact(artifact); - } - } - - // Stages the specified artifact. - private void processArtifact(String artifact) throws MojoExecutionException { - if (!artifact.startsWith(MVN_URL)) { - throw new MojoExecutionException("Unsupported artifact URL:" + artifact); - } - - String[] fields = artifact.substring(4).split("/"); - if (fields.length < 3) { - throw new MojoExecutionException("Illegal artifact URL:" + artifact); - } - - try { - String file = artifactFile(fields); - - if (projectGroupId.equals(fields[0]) && projectArtifactId.equals(fields[1])) { - // Local artifact is not installed yet, package it from target directory. - File dstDir = new File(stageDirectory, projectPath); - forceMkdir(dstDir); - copyFile(new File(dstDirectory, file), new File(dstDir, file)); - } else { - // Other artifacts are packaged from ~/.m2/repository directory. - String m2Path = artifactDir(fields); - File srcDir = new File(m2Directory, m2Path); - File dstDir = new File(stageDirectory, M2_PREFIX + "/" + m2Path); - forceMkdir(dstDir); - copyFile(new File(srcDir, file), new File(dstDir, file)); - } - } catch (IOException e) { - throw new MojoExecutionException("Unable to stage artifact " + artifact, e); - } - } - - // Generates the ONOS package ZIP file. - private void generateAppPackage() throws MojoExecutionException { - File appZip = new File(dstDirectory, artifactFile(projectArtifactId, projectVersion, - APP_ZIP, null)); - try (FileOutputStream fos = new FileOutputStream(appZip); - ZipOutputStream zos = new ZipOutputStream(fos)) { - zipDirectory("", stageDirectory, zos); - projectHelper.attachArtifact(this.project, APP_ZIP, null, appZip); - } catch (IOException e) { - throw new MojoExecutionException("Unable to compress application package", e); - } - } - - // Generates artifact directory name from the specified fields. - private String artifactDir(String[] fields) { - return artifactDir(fields[0], fields[1], fields[2]); - } - - // Generates artifact directory name from the specified elements. - private String artifactDir(String gid, String aid, String version) { - return gid.replace('.', '/') + "/" + aid.replace('.', '/') + "/" + version; - } - - // Generates artifact file name from the specified fields. - private String artifactFile(String[] fields) { - return fields.length < 5 ? - artifactFile(fields[1], fields[2], - (fields.length < 4 ? JAR : fields[3]), null) : - artifactFile(fields[1], fields[2], fields[3], fields[4]); - } - - // Generates artifact file name from the specified elements. - private String artifactFile(String aid, String version, String type, - String classifier) { - return classifier == null ? aid + "-" + version + "." + type : - aid + "-" + version + "-" + classifier + "." + type; - } - - // Returns the given string with project variable substitutions. - private String eval(String string) { - return string == null ? null : - string.replaceAll("\\$\\{onos.app.name\\}", name) - .replaceAll("\\$\\{onos.app.origin\\}", origin) - .replaceAll("\\$\\{onos.app.requires\\}", requiredApps) - .replaceAll("\\$\\{project.groupId\\}", projectGroupId) - .replaceAll("\\$\\{project.artifactId\\}", projectArtifactId) - .replaceAll("\\$\\{project.version\\}", projectVersion) - .replaceAll("\\$\\{project.description\\}", projectDescription); - } - - // Recursively archives the specified directory into a given ZIP stream. - private void zipDirectory(String root, File dir, ZipOutputStream zos) - throws IOException { - byte[] buffer = new byte[BUFFER_SIZE]; - File[] files = dir.listFiles(); - if (files != null && files.length > 0) { - for (File file : files) { - if (file.isDirectory()) { - String path = root + file.getName() + "/"; - zos.putNextEntry(new ZipEntry(path)); - zipDirectory(path, file, zos); - zos.closeEntry(); - } else { - FileInputStream fin = new FileInputStream(file); - zos.putNextEntry(new ZipEntry(root + file.getName())); - int length; - while ((length = fin.read(buffer)) > 0) { - zos.write(buffer, 0, length); - } - zos.closeEntry(); - fin.close(); - } - } - } - } -} diff --git a/framework/src/onos/tools/package/maven-plugin/src/main/java/org/onosproject/maven/OnosCfgMojo.java b/framework/src/onos/tools/package/maven-plugin/src/main/java/org/onosproject/maven/OnosCfgMojo.java deleted file mode 100644 index 3e3e17a0..00000000 --- a/framework/src/onos/tools/package/maven-plugin/src/main/java/org/onosproject/maven/OnosCfgMojo.java +++ /dev/null @@ -1,141 +0,0 @@ -/* - * 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.maven; - -import com.thoughtworks.qdox.JavaProjectBuilder; -import com.thoughtworks.qdox.model.JavaAnnotation; -import com.thoughtworks.qdox.model.JavaClass; -import com.thoughtworks.qdox.model.JavaField; -import org.apache.maven.plugin.AbstractMojo; -import org.apache.maven.plugin.MojoExecutionException; -import org.apache.maven.plugins.annotations.LifecyclePhase; -import org.apache.maven.plugins.annotations.Mojo; -import org.apache.maven.plugins.annotations.Parameter; - -import java.io.File; -import java.io.FileWriter; -import java.io.IOException; -import java.io.PrintWriter; -import java.util.ArrayList; -import java.util.List; - -/** - * Produces ONOS component configuration catalogue resources. - */ -@Mojo(name = "cfg", defaultPhase = LifecyclePhase.GENERATE_RESOURCES) -public class OnosCfgMojo extends AbstractMojo { - - private static final String COMPONENT = "org.apache.felix.scr.annotations.Component"; - private static final String PROPERTY = "org.apache.felix.scr.annotations.Property"; - private static final String SEP = "|"; - - /** - * The directory where the generated catalogue file will be put. - */ - @Parameter(defaultValue = "${basedir}") - protected File srcDirectory; - - /** - * The directory where the generated catalogue file will be put. - */ - @Parameter(defaultValue = "${project.build.outputDirectory}") - protected File dstDirectory; - - @Override - public void execute() throws MojoExecutionException { - getLog().info("Generating ONOS component configuration catalogues..."); - try { - JavaProjectBuilder builder = new JavaProjectBuilder(); - builder.addSourceTree(new File(srcDirectory, "src/main/java")); - builder.getClasses().forEach(this::processClass); - } catch (Exception e) { - e.printStackTrace(); - throw e; - } - } - - private void processClass(JavaClass javaClass) { - boolean isComponent = javaClass.getAnnotations().stream() - .map(ja -> ja.getType().getName().equals(COMPONENT)) - .findFirst().isPresent(); - if (isComponent) { - List<String> lines = new ArrayList<>(); - javaClass.getFields().forEach(field -> processField(lines, javaClass, field)); - if (!lines.isEmpty()) { - writeCatalog(javaClass, lines); - } - } - } - - private void writeCatalog(JavaClass javaClass, List<String> lines) { - File dir = new File(dstDirectory, javaClass.getPackageName().replace('.', '/')); - dir.mkdirs(); - - File cfgDef = new File(dir, javaClass.getName().replace('.', '/') + ".cfgdef"); - try (FileWriter fw = new FileWriter(cfgDef); - PrintWriter pw = new PrintWriter(fw)) { - pw.println("# This file is auto-generated by onos-maven-plugin"); - lines.forEach(pw::println); - } catch (IOException e) { - System.err.println("Unable to write catalog for " + javaClass.getName()); - e.printStackTrace(); - } - } - - private void processField(List<String> lines, JavaClass javaClass, JavaField field) { - field.getAnnotations().forEach(ja -> { - if (ja.getType().getName().equals(PROPERTY)) { - lines.add(expand(javaClass, ja.getNamedParameter("name").toString()) + - SEP + type(field) + - SEP + defaultValue(javaClass, field, ja) + - SEP + description(ja)); - } - }); - } - - // TODO: Stuff below is very much hack-ish and should be redone; it works for now though. - - private String description(JavaAnnotation annotation) { - String description = (String) annotation.getNamedParameter("label"); - return description.replaceAll("\" \\+ \"", "") - .replaceFirst("^[^\"]*\"", "").replaceFirst("\"$", ""); - } - - private String type(JavaField field) { - String ft = field.getType().getName().toUpperCase(); - return ft.equals("INT") ? "INTEGER" : ft; - } - - private String defaultValue(JavaClass javaClass, JavaField field, - JavaAnnotation annotation) { - String ft = field.getType().getName().toLowerCase(); - String defValueName = ft.equals("boolean") ? "boolValue" : - ft.equals("string") ? "value" : ft + "Value"; - Object dv = annotation.getNamedParameter(defValueName); - return dv == null ? "" : expand(javaClass, dv.toString()); - } - - private String stripQuotes(String string) { - return string.trim().replaceFirst("^[^\"]*\"", "").replaceFirst("\"$", ""); - } - - private String expand(JavaClass javaClass, String value) { - JavaField field = javaClass.getFieldByName(value); - return field == null ? stripQuotes(value) : - stripQuotes(field.getCodeBlock().replaceFirst(".*=", "").replaceFirst(";$", "")); - } - -} diff --git a/framework/src/onos/tools/package/maven-plugin/src/main/java/org/onosproject/maven/OnosSwaggerMojo.java b/framework/src/onos/tools/package/maven-plugin/src/main/java/org/onosproject/maven/OnosSwaggerMojo.java deleted file mode 100644 index a98557dc..00000000 --- a/framework/src/onos/tools/package/maven-plugin/src/main/java/org/onosproject/maven/OnosSwaggerMojo.java +++ /dev/null @@ -1,495 +0,0 @@ -/* - * 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.maven; - -import com.fasterxml.jackson.databind.ObjectMapper; -import com.fasterxml.jackson.databind.node.ArrayNode; -import com.fasterxml.jackson.databind.node.ObjectNode; -import com.google.common.base.Charsets; -import com.google.common.io.ByteStreams; -import com.google.common.io.Files; -import com.thoughtworks.qdox.JavaProjectBuilder; -import com.thoughtworks.qdox.model.DocletTag; -import com.thoughtworks.qdox.model.JavaAnnotation; -import com.thoughtworks.qdox.model.JavaClass; -import com.thoughtworks.qdox.model.JavaMethod; -import com.thoughtworks.qdox.model.JavaParameter; -import com.thoughtworks.qdox.model.JavaType; -import org.apache.maven.plugin.AbstractMojo; -import org.apache.maven.plugin.MojoExecutionException; -import org.apache.maven.plugins.annotations.LifecyclePhase; -import org.apache.maven.plugins.annotations.Mojo; -import org.apache.maven.plugins.annotations.Parameter; -import org.apache.maven.project.MavenProject; - -import java.io.File; -import java.io.FileWriter; -import java.io.IOException; -import java.io.PrintWriter; -import java.util.HashMap; -import java.util.Map; -import java.util.Optional; - -import static com.google.common.base.Strings.isNullOrEmpty; - -/** - * Produces ONOS Swagger api-doc. - */ -@Mojo(name = "swagger", defaultPhase = LifecyclePhase.GENERATE_SOURCES) -public class OnosSwaggerMojo extends AbstractMojo { - private final ObjectMapper mapper = new ObjectMapper(); - - private static final String JSON_FILE = "swagger.json"; - private static final String GEN_SRC = "generated-sources"; - private static final String REG_SRC = "registrator.javat"; - - private static final String PATH = "javax.ws.rs.Path"; - private static final String PATH_PARAM = "javax.ws.rs.PathParam"; - private static final String QUERY_PARAM = "javax.ws.rs.QueryParam"; - private static final String POST = "javax.ws.rs.POST"; - private static final String GET = "javax.ws.rs.GET"; - private static final String PUT = "javax.ws.rs.PUT"; - private static final String DELETE = "javax.ws.rs.DELETE"; - private static final String PRODUCES = "javax.ws.rs.Produces"; - private static final String CONSUMES = "javax.ws.rs.Consumes"; - private static final String JSON = "MediaType.APPLICATION_JSON"; - private static final String OCTET_STREAM = "MediaType.APPLICATION_OCTET_STREAM"; - - /** - * The directory where the generated catalogue file will be put. - */ - @Parameter(defaultValue = "${basedir}") - protected File srcDirectory; - - /** - * The directory where the generated catalogue file will be put. - */ - @Parameter(defaultValue = "${project.build.directory}") - protected File dstDirectory; - - /** - * REST API web-context - */ - @Parameter(defaultValue = "${web.context}") - protected String webContext; - - /** - * REST API version - */ - @Parameter(defaultValue = "${api.version}") - protected String apiVersion; - - /** - * REST API description - */ - @Parameter(defaultValue = "${api.description}") - protected String apiDescription; - - /** - * REST API title - */ - @Parameter(defaultValue = "${api.title}") - protected String apiTitle; - - /** - * REST API title - */ - @Parameter(defaultValue = "${api.package}") - protected String apiPackage; - - /** - * Maven project - */ - @Parameter(defaultValue = "${project}") - protected MavenProject project; - - - @Override - public void execute() throws MojoExecutionException { - try { - JavaProjectBuilder builder = new JavaProjectBuilder(); - builder.addSourceTree(new File(srcDirectory, "src/main/java")); - - ObjectNode root = initializeRoot(); - ArrayNode tags = mapper.createArrayNode(); - ObjectNode paths = mapper.createObjectNode(); - ObjectNode definitions = mapper.createObjectNode(); - - root.set("tags", tags); - root.set("paths", paths); - root.set("definitions", definitions); - - builder.getClasses().forEach(jc -> processClass(jc, paths, tags, definitions)); - - if (paths.size() > 0) { - getLog().info("Generating ONOS REST API documentation..."); - genCatalog(root); - - if (!isNullOrEmpty(apiPackage)) { - genRegistrator(); - } - } - - project.addCompileSourceRoot(new File(dstDirectory, GEN_SRC).getPath()); - - } catch (Exception e) { - getLog().warn("Unable to generate ONOS REST API documentation", e); - throw e; - } - } - - // initializes top level root with Swagger required specifications - private ObjectNode initializeRoot() { - ObjectNode root = mapper.createObjectNode(); - root.put("swagger", "2.0"); - ObjectNode info = mapper.createObjectNode(); - root.set("info", info); - - root.put("basePath", webContext); - info.put("version", apiVersion); - info.put("title", apiTitle); - info.put("description", apiDescription); - - ArrayNode produces = mapper.createArrayNode(); - produces.add("application/json"); - root.set("produces", produces); - - ArrayNode consumes = mapper.createArrayNode(); - consumes.add("application/json"); - root.set("consumes", consumes); - - return root; - } - - // Checks whether javaClass has a path tag associated with it and if it does - // processes its methods and creates a tag for the class on the root - void processClass(JavaClass javaClass, ObjectNode paths, ArrayNode tags, ObjectNode definitions) { - // If the class does not have a Path tag then ignore it - JavaAnnotation annotation = getPathAnnotation(javaClass); - if (annotation == null) { - return; - } - - String path = getPath(annotation); - if (path == null) { - return; - } - - String resourcePath = "/" + path; - String tagPath = path.isEmpty() ? "/" : path; - - // Create tag node for this class. - ObjectNode tagObject = mapper.createObjectNode(); - tagObject.put("name", tagPath); - if (javaClass.getComment() != null) { - tagObject.put("description", shortText(javaClass.getComment())); - } - tags.add(tagObject); - - // Create an array node add to all methods from this class. - ArrayNode tagArray = mapper.createArrayNode(); - tagArray.add(tagPath); - - processAllMethods(javaClass, resourcePath, paths, tagArray, definitions); - } - - private JavaAnnotation getPathAnnotation(JavaClass javaClass) { - Optional<JavaAnnotation> optional = javaClass.getAnnotations() - .stream().filter(a -> a.getType().getName().equals(PATH)).findAny(); - return optional.isPresent() ? optional.get() : null; - } - - // Checks whether a class's methods are REST methods and then places all the - // methods under a specific path into the paths node - private void processAllMethods(JavaClass javaClass, String resourcePath, - ObjectNode paths, ArrayNode tagArray, ObjectNode definitions) { - // map of the path to its methods represented by an ObjectNode - Map<String, ObjectNode> pathMap = new HashMap<>(); - - javaClass.getMethods().forEach(javaMethod -> { - javaMethod.getAnnotations().forEach(annotation -> { - String name = annotation.getType().getName(); - if (name.equals(POST) || name.equals(GET) || name.equals(DELETE) || name.equals(PUT)) { - // substring(12) removes "javax.ws.rs." - String method = annotation.getType().toString().substring(12).toLowerCase(); - processRestMethod(javaMethod, method, pathMap, resourcePath, tagArray, definitions); - } - }); - }); - - // for each path add its methods to the path node - for (Map.Entry<String, ObjectNode> entry : pathMap.entrySet()) { - paths.set(entry.getKey(), entry.getValue()); - } - - - } - - private void processRestMethod(JavaMethod javaMethod, String method, - Map<String, ObjectNode> pathMap, - String resourcePath, ArrayNode tagArray, ObjectNode definitions) { - String fullPath = resourcePath, consumes = "", produces = "", - comment = javaMethod.getComment(); - DocletTag tag = javaMethod.getTagByName("onos.rsModel"); - for (JavaAnnotation annotation : javaMethod.getAnnotations()) { - String name = annotation.getType().getName(); - if (name.equals(PATH)) { - fullPath = resourcePath + "/" + getPath(annotation); - fullPath = fullPath.replaceFirst("^//", "/"); - } - if (name.equals(CONSUMES)) { - consumes = getIOType(annotation); - } - if (name.equals(PRODUCES)) { - produces = getIOType(annotation); - } - } - ObjectNode methodNode = mapper.createObjectNode(); - methodNode.set("tags", tagArray); - - addSummaryDescriptions(methodNode, comment); - addJsonSchemaDefinition(definitions, tag); - - processParameters(javaMethod, methodNode, method, tag); - - processConsumesProduces(methodNode, "consumes", consumes); - processConsumesProduces(methodNode, "produces", produces); - if (tag == null || ((method.toLowerCase().equals("post") || method.toLowerCase().equals("put")) - && !(tag.getParameters().size() > 1))) { - addResponses(methodNode, tag, false); - } else { - addResponses(methodNode, tag, true); - } - - ObjectNode operations = pathMap.get(fullPath); - if (operations == null) { - operations = mapper.createObjectNode(); - operations.set(method, methodNode); - pathMap.put(fullPath, operations); - } else { - operations.set(method, methodNode); - } - } - - private void addJsonSchemaDefinition(ObjectNode definitions, DocletTag tag) { - File definitionsDirectory = new File(srcDirectory + "/src/main/resources/definitions"); - if (tag != null) { - tag.getParameters().stream().forEach(param -> { - try { - File config = new File(definitionsDirectory.getAbsolutePath() + "/" - + param + ".json"); - String lines = Files.readLines(config, Charsets.UTF_8).stream().reduce((t, u) -> t + u). - get(); - lines = lines.replaceAll("\\s+",""); - definitions.putPOJO(param, lines); - } catch (IOException e) { - e.printStackTrace(); - } - }); - - } - } - - private void processConsumesProduces(ObjectNode methodNode, String type, String io) { - if (!io.equals("")) { - ArrayNode array = mapper.createArrayNode(); - methodNode.set(type, array); - array.add(io); - } - } - - private void addSummaryDescriptions(ObjectNode methodNode, String comment) { - String summary = "", description; - if (comment != null) { - if (comment.contains(".")) { - int periodIndex = comment.indexOf("."); - summary = comment.substring(0, periodIndex); - description = comment.length() > periodIndex + 1 ? - comment.substring(periodIndex + 1).trim() : ""; - } else { - description = comment; - } - methodNode.put("summary", summary); - methodNode.put("description", description); - } - } - - // Temporary solution to add responses to a method - private void addResponses(ObjectNode methodNode, DocletTag tag, boolean responseJson) { - ObjectNode responses = mapper.createObjectNode(); - methodNode.set("responses", responses); - - ObjectNode success = mapper.createObjectNode(); - success.put("description", "successful operation"); - responses.set("200", success); - if (tag != null && responseJson) { - ObjectNode schema = mapper.createObjectNode(); - tag.getParameters().stream().forEach( - param -> schema.put("$ref", "#/definitions/" + param)); - success.set("schema", schema); - } - - ObjectNode defaultObj = mapper.createObjectNode(); - defaultObj.put("description", "Unexpected error"); - responses.set("default", defaultObj); - } - - // Checks if the annotations has a value of JSON and returns the string - // that Swagger requires - private String getIOType(JavaAnnotation annotation) { - if (annotation.getNamedParameter("value").toString().equals(JSON)) { - return "application/json"; - } else if (annotation.getNamedParameter("value").toString().equals(OCTET_STREAM)){ - return "application/octet_stream"; - } - return ""; - } - - // If the annotation has a Path tag, returns the value with leading and - // trailing double quotes and slash removed. - private String getPath(JavaAnnotation annotation) { - String path = annotation.getNamedParameter("value").toString(); - return path == null ? null : path.replaceAll("(^[\\\"/]*|[/\\\"]*$)", ""); - } - - // Processes parameters of javaMethod and enters the proper key-values into the methodNode - private void processParameters(JavaMethod javaMethod, ObjectNode methodNode, String method, DocletTag tag) { - ArrayNode parameters = mapper.createArrayNode(); - methodNode.set("parameters", parameters); - boolean required = true; - - for (JavaParameter javaParameter : javaMethod.getParameters()) { - ObjectNode individualParameterNode = mapper.createObjectNode(); - Optional<JavaAnnotation> optional = javaParameter.getAnnotations().stream().filter( - annotation -> annotation.getType().getName().equals(PATH_PARAM) || - annotation.getType().getName().equals(QUERY_PARAM)).findAny(); - JavaAnnotation pathType = optional.isPresent() ? optional.get() : null; - - String annotationName = javaParameter.getName(); - - - if (pathType != null) { //the parameter is a path or query parameter - individualParameterNode.put("name", - pathType.getNamedParameter("value") - .toString().replace("\"", "")); - if (pathType.getType().getName().equals(PATH_PARAM)) { - individualParameterNode.put("in", "path"); - } else if (pathType.getType().getName().equals(QUERY_PARAM)) { - individualParameterNode.put("in", "query"); - } - individualParameterNode.put("type", getType(javaParameter.getType())); - } else { // the parameter is a body parameter - individualParameterNode.put("name", annotationName); - individualParameterNode.put("in", "body"); - - // Adds the reference to the Json model for the input - // that goes in the post or put operation - if (tag != null && (method.toLowerCase().equals("post") || - method.toLowerCase().equals("put"))) { - ObjectNode schema = mapper.createObjectNode(); - tag.getParameters().stream().forEach(param -> { - schema.put("$ref", "#/definitions/" + param); - }); - individualParameterNode.set("schema", schema); - } - } - for (DocletTag p : javaMethod.getTagsByName("param")) { - if (p.getValue().contains(annotationName)) { - try { - String description = p.getValue().split(" ", 2)[1].trim(); - if (description.contains("optional")) { - required = false; - } - individualParameterNode.put("description", description); - } catch (Exception e) { - e.printStackTrace(); - } - } - } - individualParameterNode.put("required", required); - parameters.add(individualParameterNode); - } - } - - // Returns the Swagger specified strings for the type of a parameter - private String getType(JavaType javaType) { - String type = javaType.getFullyQualifiedName(); - String value; - if (type.equals(String.class.getName())) { - value = "string"; - } else if (type.equals("int")) { - value = "integer"; - } else if (type.equals(boolean.class.getName())) { - value = "boolean"; - } else if (type.equals(long.class.getName())) { - value = "number"; - } else { - value = ""; - } - return value; - } - - // Writes the swagger.json file using the supplied JSON root. - private void genCatalog(ObjectNode root) { - File swaggerCfg = new File(dstDirectory, JSON_FILE); - if (dstDirectory.exists() || dstDirectory.mkdirs()) { - try (FileWriter fw = new FileWriter(swaggerCfg); - PrintWriter pw = new PrintWriter(fw)) { - pw.println(root.toString()); - } catch (IOException e) { - getLog().warn("Unable to write " + JSON_FILE); - } - } else { - getLog().warn("Unable to create " + dstDirectory); - } - } - - // Generates the registrator Java component. - private void genRegistrator() { - File dir = new File(dstDirectory, GEN_SRC); - File reg = new File(dir, apiPackage.replaceAll("\\.", "/") + "/ApiDocRegistrator.java"); - File pkg = reg.getParentFile(); - if (pkg.exists() || pkg.mkdirs()) { - try { - String src = new String(ByteStreams.toByteArray(getClass().getResourceAsStream(REG_SRC))); - src = src.replace("${api.package}", apiPackage) - .replace("${web.context}", webContext) - .replace("${api.title}", apiTitle) - .replace("${api.description}", apiTitle); - Files.write(src.getBytes(), reg); - } catch (IOException e) { - getLog().warn("Unable to write " + reg); - } - } else { - getLog().warn("Unable to create " + reg); - } - } - - // Returns "nickname" based on method and path for a REST method - private String setNickname(String method, String path) { - if (!path.equals("")) { - return (method + path.replace('/', '_').replace("{", "").replace("}", "")).toLowerCase(); - } else { - return method.toLowerCase(); - } - } - - private String shortText(String comment) { - int i = comment.indexOf('.'); - return i > 0 ? comment.substring(0, i) : comment; - } - -} diff --git a/framework/src/onos/tools/package/maven-plugin/src/main/resources/org/onosproject/maven/app.xml b/framework/src/onos/tools/package/maven-plugin/src/main/resources/org/onosproject/maven/app.xml deleted file mode 100644 index 84998807..00000000 --- a/framework/src/onos/tools/package/maven-plugin/src/main/resources/org/onosproject/maven/app.xml +++ /dev/null @@ -1,22 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!-- - ~ 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. - --> -<app name="${onos.app.name}" origin="${onos.app.origin}" version="${project.version}" - featuresRepo="mvn:${project.groupId}/${project.artifactId}/${project.version}/xml/features" - features="${project.artifactId}" apps="${onos.app.requires}"> - <description>${project.description}</description> - <artifact>mvn:${project.groupId}/${project.artifactId}/${project.version}</artifact> -</app> diff --git a/framework/src/onos/tools/package/maven-plugin/src/main/resources/org/onosproject/maven/features.xml b/framework/src/onos/tools/package/maven-plugin/src/main/resources/org/onosproject/maven/features.xml deleted file mode 100644 index 5b08d80a..00000000 --- a/framework/src/onos/tools/package/maven-plugin/src/main/resources/org/onosproject/maven/features.xml +++ /dev/null @@ -1,23 +0,0 @@ -<?xml version="1.0" encoding="UTF-8" standalone="yes"?> -<!-- - ~ 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. - --> -<features xmlns="http://karaf.apache.org/xmlns/features/v1.2.0" name="${project.artifactId}-${project.version}"> - <feature name="${project.artifactId}" version="${project.version}" - description="${project.description}"> - <feature>onos-api</feature> - <bundle>mvn:${project.groupId}/${project.artifactId}/${project.version}</bundle> - </feature> -</features> diff --git a/framework/src/onos/tools/package/maven-plugin/src/main/resources/org/onosproject/maven/registrator.javat b/framework/src/onos/tools/package/maven-plugin/src/main/resources/org/onosproject/maven/registrator.javat deleted file mode 100644 index a8e26536..00000000 --- a/framework/src/onos/tools/package/maven-plugin/src/main/resources/org/onosproject/maven/registrator.javat +++ /dev/null @@ -1,31 +0,0 @@ -/* - * Auto-generated by OnosSwaggerMojo. - * - * 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 ${api.package}; - -import org.apache.felix.scr.annotations.Component; -import org.onosproject.rest.AbstractApiDocRegistrator; -import org.onosproject.rest.ApiDocProvider; - -@Component(immediate = true) -public class ApiDocRegistrator extends AbstractApiDocRegistrator { - public ApiDocRegistrator() { - super(new ApiDocProvider("${web.context}", - "${api.title}", - ApiDocRegistrator.class.getClassLoader())); - } -} diff --git a/framework/src/onos/tools/package/rpm/onos.spec b/framework/src/onos/tools/package/rpm/onos.spec deleted file mode 100644 index df0a05d5..00000000 --- a/framework/src/onos/tools/package/rpm/onos.spec +++ /dev/null @@ -1,71 +0,0 @@ -Name: onos -Version: @ONOS_RPM_VERSION -Release: 1 -Summary: Open Networking Operating System (ONOS) -Vendor: ONOS Project -Packager: ONOS Project - -Group: Applications/Engineering -License: Apache 2.0 -Requires: jre >= 1:8 -URL: http://www.onosproject.org -Source0: %{name}-@ONOS_RPM_VERSION.tar.gz - -BuildArch: noarch -BuildRoot: %{_tmppath}/%{name}-buildroot - -%description -Open Network Operating System (ONOS) is an open source SDN controller. - -%prep -%setup -q - -%install -mkdir -p %{buildroot} -cp -R * %{buildroot} - -%clean -rm -rf %{buildroot} - -%files -%defattr(-,root,root,-) -/etc/init/onos.conf -/opt/onos/ - -%post -ONOS_USER=sdn - -# Check to see if user exists, and if not, create a service account -getent passwd $ONOS_USER >/dev/null 2&>1 || ( useradd -M $ONOS_USER && usermod -L $ONOS_USER ) - -# Create ONOS options file -[ ! -f /opt/onos/options ] && cat << EOF > /opt/onos/options -export ONOS_OPTS=server -export ONOS_USER="$ONOS_USER" -EOF - -# Change permissions for onos directory -[ -d /opt/onos ] && chown -R $ONOS_USER.$ONOS_USER /opt/onos - -echo ONOS successfully installed at /opt/onos - -%preun -# Check if onos is running; if it is, stop onos -[ -z "$(status onos 2>/dev/null | grep start)" ] && echo "onos is not running." || ( - stop onos - - # Wait for onos to stop up to 5 seconds - for i in $(seq 1 5); do - [ -z "$(ps -ef | grep karaf.jar | grep -v grep)" ] && break - sleep 1 - done - [ -z "$(ps -ef | grep karaf.jar | grep -v grep)" ] && echo 'Stopped onos service' || echo 'Failed to stop onos' -) - -%postun -#TODO this should be less brute-force -rm -rf /opt/onos - -%changelog -# TODO - diff --git a/framework/src/onos/tools/package/yangtools/pom.xml b/framework/src/onos/tools/package/yangtools/pom.xml deleted file mode 100644 index 82422c0f..00000000 --- a/framework/src/onos/tools/package/yangtools/pom.xml +++ /dev/null @@ -1,76 +0,0 @@ -<?xml version="1.0" encoding="UTF-8" standalone="no"?> -<project xmlns="http://maven.apache.org/POM/4.0.0" - xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> - <modelVersion>4.0.0</modelVersion> - <groupId>org.onosproject</groupId> - <artifactId>yangloader</artifactId> - <version>1.0-SNAPSHOT</version> - <dependencies> - <dependency> - <groupId>commons-configuration</groupId> - <artifactId>commons-configuration</artifactId> - <version>1.10</version> - </dependency> - <dependency> - <groupId>commons-io</groupId> - <artifactId>commons-io</artifactId> - <version>2.4</version> - </dependency> - <dependency> - <groupId>com.google.guava</groupId> - <artifactId>guava</artifactId> - <version>18.0</version> - </dependency> - <dependency> - <groupId>org.onosproject</groupId> - <artifactId>onlab-misc</artifactId> - <version>1.4.0-SNAPSHOT</version> - </dependency> - <dependency> - <groupId>commons-collections</groupId> - <artifactId>commons-collections</artifactId> - <version>3.2.1</version> - <optional>true</optional> - </dependency> - <dependency> - <groupId>org.slf4j</groupId> - <artifactId>slf4j-jdk14</artifactId> - <version>1.7.12</version> - </dependency> - </dependencies> - <build> - <plugins> - <plugin> - <groupId>org.apache.maven.plugins</groupId> - <artifactId>maven-compiler-plugin</artifactId> - <version>3.3</version> - <configuration> - <source>1.8</source> - <target>1.8</target> - </configuration> - </plugin> - <plugin> - <groupId>org.apache.maven.plugins</groupId> - <artifactId>maven-shade-plugin</artifactId> - <version>2.3</version> - <executions> - <execution> - <phase>package</phase> - <goals> - <goal>shade</goal> - </goals> - <configuration> - <transformers> - <transformer implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer"> - <mainClass>org.onoproject.yangtool.YangLoaderMain</mainClass> - </transformer> - </transformers> - </configuration> - </execution> - </executions> - </plugin> - </plugins> - </build> - -</project> diff --git a/framework/src/onos/tools/package/yangtools/src/main/java/org/onoproject/yangtool/YangLoader.java b/framework/src/onos/tools/package/yangtools/src/main/java/org/onoproject/yangtool/YangLoader.java deleted file mode 100644 index 37126890..00000000 --- a/framework/src/onos/tools/package/yangtools/src/main/java/org/onoproject/yangtool/YangLoader.java +++ /dev/null @@ -1,167 +0,0 @@ -package org.onoproject.yangtool; - -import com.google.common.io.Files; -import org.apache.commons.configuration.ConfigurationException; -import org.apache.commons.configuration.XMLConfiguration; -import org.apache.commons.io.FileUtils; -import org.apache.commons.io.IOUtils; -import org.onlab.util.Tools; - -import java.io.BufferedReader; -import java.io.File; -import java.io.FileInputStream; -import java.io.IOException; -import java.io.InputStream; -import java.io.InputStreamReader; -import java.io.PrintWriter; -import java.nio.charset.Charset; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.List; -import java.util.stream.Collectors; - -/** - * Class that takes in input two paths, one to the yang file and one where - * to generate the interface, and a yang container name, generates the sources - * through OpenDaylight code generator plugin from yang, and modifies - * them accordingly to the needs of the ONOS behavior system. - */ -public class YangLoader { - /** - * Public method to take a yang file from the input folder and generate classes - * to the output folder. - * @param inputFolder forlder with the yang files - * @param completeOuputFolder folder where to put the desired classes - * @throws IOException - * @throws ConfigurationException - * @throws InterruptedException - */ - public void generateBehaviourInterface(String inputFolder, - String completeOuputFolder) - throws IOException, ConfigurationException, InterruptedException { - File projectDir = createTemporaryProject(inputFolder); - List<String> containerNames = findContainerName( - new File(projectDir.getAbsolutePath() + "/src")); - System.out.println("Containers " + containerNames); - generateJava(projectDir); - //modifyClasses(containerName, projectDir, completeInterfaceOuputFolder); - copyFiles(new File(projectDir.getAbsolutePath() + "/dst"), - new File(completeOuputFolder)); - //System.out.println("Sources in " + completeOuputFolder); - - } - - private List<String> findContainerName(File scrDir) { - List<String> allContainers = new ArrayList<>(); - Arrays.asList(scrDir.listFiles()).stream().forEach(f -> { - try { - FileUtils.readLines(f).stream() - .filter(line -> line.matches("(.*)container(.*)\\{")) - .collect(Collectors.toList()).forEach(s -> { - s = s.replace("container", ""); - s = s.replace("{", ""); - allContainers.add(s.trim()); - }); - - } catch (IOException e) { - throw new RuntimeException(e); - } - }); - return allContainers; - } - - private File createTemporaryProject(String inputFolder) throws IOException, - ConfigurationException { - File tempDir = Files.createTempDir(); - File scrDir = new File(tempDir, "src"); - scrDir.mkdir(); - copyFiles(new File(inputFolder), scrDir); - createPomFile(tempDir, scrDir); - return tempDir; - - } - - private void copyFiles(File inputFolder, File scrDir) throws IOException { - Tools.copyDirectory(inputFolder, scrDir); - } - - private void createPomFile(File tempDir, File scrDir) throws ConfigurationException { - File pom = new File(tempDir, "pom.xml"); - File dstDir = new File(tempDir, "dst"); - dstDir.mkdir(); - XMLConfiguration cfg = new XMLConfiguration(); - cfg.load(getClass().getResourceAsStream("/pom-template.xml")); - cfg.setProperty("build.plugins.plugin.executions.execution." + - "configuration.yangFilesRootDir", scrDir.getPath()); - cfg.setProperty("build.plugins.plugin.executions." + - "execution.configuration.codeGenerators." + - "generator.outputBaseDir", dstDir.getPath()); - cfg.save(pom); - } - - private void generateJava(File projectDir) - throws IOException, InterruptedException { - Runtime rt = Runtime.getRuntime(); - Process pr = rt.exec("mvn generate-sources", null, projectDir); - String s = IOUtils.toString(pr.getInputStream(), "UTF-8"); - if (pr.waitFor() == 0) { - if (s.contains("[WARNING]")) { - System.out.println("Sources not generated, warning log: \n" + s); - } else { - System.out.println("Sources generated"); - } - } else { - System.out.println("Sources not generated. " + s + - " \nError " + pr.getInputStream().read()); - } - } - - //parsing classes part, for now is not used. - private void modifyClasses(String containerName, File projectDir, - String pathToNewInterface) throws IOException { - String odlInterfacepath = getPathWithFileName(containerName, projectDir.getPath()); - odlInterfacepath = odlInterfacepath + "/"; - parseClass(odlInterfacepath, pathToNewInterface, containerName); - System.out.println("ONOS behaviour interface generated " + - "correctly at " + pathToNewInterface); - } - - private String getPathWithFileName(String filename, String pathToGenerated) { - File[] directories = new File(pathToGenerated).listFiles(File::isDirectory); - while (directories.length != 0) { - pathToGenerated = pathToGenerated + "/" + directories[0].getName(); - directories = new File(pathToGenerated).listFiles(File::isDirectory); - } - File dir = new File(pathToGenerated); - File behaviour = (File) Arrays.asList(dir.listFiles()).stream() - .filter(f -> f.getName().equals(filename)).toArray()[0]; - return behaviour.getParentFile().getAbsolutePath(); - } - - private void parseClass(String filePath, String pathToNewInterface, - String filename) throws IOException { - InputStream fis = null; - String newFile = "package org.onosproject.net.behaviour;\n" + - "import org.onosproject.net.driver.HandlerBehaviour;\n"; - fis = new FileInputStream(filePath + filename); - InputStreamReader isr = new InputStreamReader(fis, Charset.forName("UTF-8")); - BufferedReader br = new BufferedReader(isr); - String line; - while ((line = br.readLine()) != null) { - if (!line.contains("org.opendaylight.")) { - if (line.contains("ChildOf")) { - newFile = newFile + "HandlerBehaviour\n"; - } else { - newFile = newFile + line + "\n"; - } - } - } - PrintWriter out = new PrintWriter(pathToNewInterface + - filename.replace(".java", "") - + "Interface.java"); - out.print(newFile); - out.flush(); - } - - -} diff --git a/framework/src/onos/tools/package/yangtools/src/main/java/org/onoproject/yangtool/YangLoaderMain.java b/framework/src/onos/tools/package/yangtools/src/main/java/org/onoproject/yangtool/YangLoaderMain.java deleted file mode 100644 index 7b137677..00000000 --- a/framework/src/onos/tools/package/yangtools/src/main/java/org/onoproject/yangtool/YangLoaderMain.java +++ /dev/null @@ -1,16 +0,0 @@ -package org.onoproject.yangtool; - -import org.apache.commons.configuration.ConfigurationException; - -import java.io.IOException; - -/** - * Main of the uangloader tool in order to be called through command line. - */ -public class YangLoaderMain { - public static void main (String args []) throws IOException, - ConfigurationException, InterruptedException { - YangLoader yl = new YangLoader(); - yl.generateBehaviourInterface(args[0], args[1]); - } -} diff --git a/framework/src/onos/tools/package/yangtools/src/main/resources/pom-template.xml b/framework/src/onos/tools/package/yangtools/src/main/resources/pom-template.xml deleted file mode 100644 index 5280e213..00000000 --- a/framework/src/onos/tools/package/yangtools/src/main/resources/pom-template.xml +++ /dev/null @@ -1,95 +0,0 @@ -<?xml version="1.0" encoding="UTF-8" standalone="no"?> -<project xmlns="http://maven.apache.org/POM/4.0.0" - xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> - <modelVersion>4.0.0</modelVersion> - <groupId>groupId</groupId> - <artifactId>yangloader</artifactId> - <version>1.0-SNAPSHOT</version> - <pluginRepositories> - <pluginRepository> - <id>opendaylight-release</id> - <name>opendaylight-release</name> - <url> - http://nexus.opendaylight.org/content/repositories/opendaylight.release/ - </url> - </pluginRepository> - <pluginRepository> - <id>opendaylight-snapshot</id> - <name>opendaylight-snapshot</name> - <url> - http://nexus.opendaylight.org/content/repositories/opendaylight.snapshot/ - </url> - </pluginRepository> - </pluginRepositories> - <repositories> - <repository> - <id>opendaylight-release</id> - <name>opendaylight-release</name> - <url> - http://nexus.opendaylight.org/content/repositories/opendaylight.release/ - </url> - </repository> - <repository> - <id>opendaylight-snapshot</id> - <name>opendaylight-snapshot</name> - <url> - http://nexus.opendaylight.org/content/repositories/opendaylight.snapshot/ - </url> - </repository> - </repositories> - <dependencies> - <dependency> - <groupId>org.opendaylight.yangtools</groupId> - <artifactId>yang-binding</artifactId> - <version>0.7.2-Lithium-SR2</version> - </dependency> - </dependencies> - <build> - <plugins> - <plugin> - <groupId>org.opendaylight.yangtools</groupId> - <artifactId>yang-maven-plugin</artifactId> - <version>0.7.2-Lithium-SR2</version> - <executions> - <execution> - <goals> - <goal>generate-sources</goal> - </goals> - <configuration> - <!-- directory containing yang files to parse and generate code --> - <yangFilesRootDir>INPUTDIR</yangFilesRootDir> - <codeGenerators> - <generator> - <codeGeneratorClass> - org.opendaylight.yangtools.maven.sal.api.gen.plugin.CodeGeneratorImpl - </codeGeneratorClass> - <!-- directory into which generated files will be placed --> - <outputBaseDir>OUTPUTDIR</outputBaseDir> - </generator> - </codeGenerators> - <inspectDependencies>false</inspectDependencies> - </configuration> - </execution> - </executions> - <dependencies> - <dependency> - <groupId>org.opendaylight.yangtools</groupId> - <artifactId>maven-sal-api-gen-plugin</artifactId> - <version>0.7.2-Lithium-SR2</version> - <type>jar</type> - </dependency> - </dependencies> - </plugin> - <plugin> - <groupId>org.apache.maven.plugins</groupId> - <artifactId>maven-compiler-plugin</artifactId> - <version>3.3</version> - <configuration> - <source>1.8</source> - <target>1.8</target> - </configuration> - </plugin> - </plugins> - </build> -</project> |