Toggle navigation
Toggle navigation
This project
Loading...
Sign in
홍길동
/
onos
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Snippets
Network
Create a new issue
Builds
Commits
Issue Boards
Authored by
alshabib
2014-10-21 20:13:31 -0700
Browse Files
Options
Browse Files
Download
Plain Diff
Commit
574afdab6a68f11b44ae284378a8896c1dd695c5
574afdab
2 parents
dfc7afb1
a85542bd
Merge branch 'master' of
ssh://gerrit.onlab.us:29418/onos-next
Hide whitespace changes
Inline
Side-by-side
Showing
56 changed files
with
1063 additions
and
65 deletions
cli/pom.xml
cli/src/main/java/org/onlab/onos/cli/AbstractShellCommand.java
cli/src/main/java/org/onlab/onos/cli/Comparators.java
cli/src/main/java/org/onlab/onos/cli/MastersListCommand.java
cli/src/main/java/org/onlab/onos/cli/NodeAddCommand.java
cli/src/main/java/org/onlab/onos/cli/NodeIdCompleter.java
cli/src/main/java/org/onlab/onos/cli/NodeRemoveCommand.java
cli/src/main/java/org/onlab/onos/cli/NodesListCommand.java
cli/src/main/java/org/onlab/onos/cli/RolesCommand.java
cli/src/main/java/org/onlab/onos/cli/SummaryCommand.java
cli/src/main/java/org/onlab/onos/cli/net/AddHostToHostIntentCommand.java
cli/src/main/java/org/onlab/onos/cli/net/AddMultiPointToSinglePointIntentCommand.java
cli/src/main/java/org/onlab/onos/cli/net/AddPointToPointIntentCommand.java
cli/src/main/java/org/onlab/onos/cli/net/ClusterDevicesCommand.java
cli/src/main/java/org/onlab/onos/cli/net/ClusterIdCompleter.java
cli/src/main/java/org/onlab/onos/cli/net/ClusterLinksCommand.java
cli/src/main/java/org/onlab/onos/cli/net/ClustersListCommand.java
cli/src/main/java/org/onlab/onos/cli/net/ConnectPointCompleter.java
cli/src/main/java/org/onlab/onos/cli/net/ConnectivityIntentCommand.java
cli/src/main/java/org/onlab/onos/cli/net/DeviceIdCompleter.java
cli/src/main/java/org/onlab/onos/cli/net/DevicePortsListCommand.java
cli/src/main/java/org/onlab/onos/cli/net/DeviceRemoveCommand.java
cli/src/main/java/org/onlab/onos/cli/net/DeviceRoleCommand.java
cli/src/main/java/org/onlab/onos/cli/net/DevicesListCommand.java
cli/src/main/java/org/onlab/onos/cli/net/EthType.java
cli/src/main/java/org/onlab/onos/cli/net/EthTypeCompleter.java
cli/src/main/java/org/onlab/onos/cli/net/FlowRuleStatusCompleter.java
cli/src/main/java/org/onlab/onos/cli/net/FlowsListCommand.java
cli/src/main/java/org/onlab/onos/cli/net/HostIdCompleter.java
cli/src/main/java/org/onlab/onos/cli/net/HostsListCommand.java
cli/src/main/java/org/onlab/onos/cli/net/IntentIdCompleter.java
cli/src/main/java/org/onlab/onos/cli/net/IntentPushTestCommand.java
cli/src/main/java/org/onlab/onos/cli/net/IntentRemoveCommand.java
cli/src/main/java/org/onlab/onos/cli/net/IntentsListCommand.java
cli/src/main/java/org/onlab/onos/cli/net/LinksListCommand.java
cli/src/main/java/org/onlab/onos/cli/net/PathListCommand.java
cli/src/main/java/org/onlab/onos/cli/net/RoleCompleter.java
cli/src/main/java/org/onlab/onos/cli/net/TopologyCommand.java
cli/src/main/java/org/onlab/onos/cli/net/WipeOutCommand.java
cli/src/main/java/org/onlab/onos/cli/net/package-info.java
cli/src/main/java/org/onlab/onos/cli/package-info.java
cli/src/main/resources/OSGI-INF/blueprint/shell-config.xml
core/api/src/main/java/org/onlab/onos/event/AbstractListenerRegistry.java
core/api/src/main/java/org/onlab/onos/net/flow/DefaultTrafficTreatment.java
core/api/src/main/java/org/onlab/onos/net/intent/HostToHostIntent.java
core/api/src/main/java/org/onlab/onos/net/intent/Intent.java
core/net/src/main/java/org/onlab/onos/net/intent/impl/LinkCollectionIntentInstaller.java
core/store/dist/src/main/java/org/onlab/onos/store/cluster/messaging/impl/ClusterCommunicationManager.java
core/store/dist/src/main/java/org/onlab/onos/store/link/impl/GossipLinkStore.java
core/store/trivial/src/main/java/org/onlab/onos/store/trivial/impl/SimpleLinkStore.java
features/features.xml
pom.xml
tools/test/bin/onos-install
utils/netty/pom.xml
utils/netty/src/main/java/org/onlab/netty/InternalMessage.java
utils/netty/src/main/java/org/onlab/netty/NettyMessagingService.java
cli/pom.xml
View file @
574afda
<?xml version="1.0" encoding="UTF-8"?>
<!--
~ 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.
-->
<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"
>
...
...
cli/src/main/java/org/onlab/onos/cli/AbstractShellCommand.java
View file @
574afda
/*
* 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.
*/
package
org
.
onlab
.
onos
.
cli
;
import
org.apache.karaf.shell.commands.Option
;
...
...
cli/src/main/java/org/onlab/onos/cli/Comparators.java
View file @
574afda
/*
* 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.
*/
package
org
.
onlab
.
onos
.
cli
;
import
org.onlab.onos.cluster.ControllerNode
;
...
...
cli/src/main/java/org/onlab/onos/cli/MastersListCommand.java
View file @
574afda
/*
* 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.
*/
package
org
.
onlab
.
onos
.
cli
;
import
com.fasterxml.jackson.databind.JsonNode
;
...
...
cli/src/main/java/org/onlab/onos/cli/NodeAddCommand.java
View file @
574afda
/*
* 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.
*/
package
org
.
onlab
.
onos
.
cli
;
import
org.apache.karaf.shell.commands.Argument
;
...
...
cli/src/main/java/org/onlab/onos/cli/NodeIdCompleter.java
View file @
574afda
/*
* 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.
*/
package
org
.
onlab
.
onos
.
cli
;
import
org.apache.karaf.shell.console.Completer
;
...
...
cli/src/main/java/org/onlab/onos/cli/NodeRemoveCommand.java
View file @
574afda
/*
* 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.
*/
package
org
.
onlab
.
onos
.
cli
;
import
org.apache.karaf.shell.commands.Argument
;
...
...
cli/src/main/java/org/onlab/onos/cli/NodesListCommand.java
View file @
574afda
/*
* 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.
*/
package
org
.
onlab
.
onos
.
cli
;
import
com.fasterxml.jackson.databind.JsonNode
;
...
...
cli/src/main/java/org/onlab/onos/cli/RolesCommand.java
View file @
574afda
/*
* 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.
*/
package
org
.
onlab
.
onos
.
cli
;
import
static
com
.
google
.
common
.
collect
.
Lists
.
newArrayList
;
...
...
cli/src/main/java/org/onlab/onos/cli/SummaryCommand.java
View file @
574afda
/*
* 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.
*/
package
org
.
onlab
.
onos
.
cli
;
import
com.fasterxml.jackson.databind.ObjectMapper
;
...
...
cli/src/main/java/org/onlab/onos/cli/net/AddHostToHostIntentCommand.java
View file @
574afda
/*
* 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.
*/
package
org
.
onlab
.
onos
.
cli
.
net
;
import
org.apache.karaf.shell.commands.Argument
;
...
...
cli/src/main/java/org/onlab/onos/cli/net/AddMultiPointToSinglePointIntentCommand.java
View file @
574afda
/*
* 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.
*/
package
org
.
onlab
.
onos
.
cli
.
net
;
import
org.apache.karaf.shell.commands.Argument
;
import
org.apache.karaf.shell.commands.Command
;
import
org.onlab.onos.cli.AbstractShellCommand
;
import
org.onlab.onos.net.ConnectPoint
;
import
org.onlab.onos.net.DeviceId
;
import
org.onlab.onos.net.PortNumber
;
import
org.onlab.onos.net.flow.DefaultTrafficSelector
;
import
org.onlab.onos.net.flow.DefaultTrafficTreatment
;
import
org.onlab.onos.net.flow.TrafficSelector
;
import
org.onlab.onos.net.flow.TrafficTreatment
;
import
org.onlab.onos.net.intent.Intent
;
import
org.onlab.onos.net.intent.IntentService
;
import
org.onlab.onos.net.intent.MultiPointToSinglePointIntent
;
import
org.onlab.packet.Ethernet
;
import
java.util.HashSet
;
import
java.util.Set
;
...
...
@@ -26,7 +41,7 @@ import static org.onlab.onos.net.PortNumber.portNumber;
*/
@Command
(
scope
=
"onos"
,
name
=
"add-multi-to-single-intent"
,
description
=
"Installs point-to-point connectivity intent"
)
public
class
AddMultiPointToSinglePointIntentCommand
extends
AbstractShell
Command
{
public
class
AddMultiPointToSinglePointIntentCommand
extends
ConnectivityIntent
Command
{
@Argument
(
index
=
0
,
name
=
"ingressDevices"
,
description
=
"Ingress Device/Port Description"
,
...
...
@@ -55,9 +70,7 @@ public class AddMultiPointToSinglePointIntentCommand extends AbstractShellComman
ingressPoints
.
add
(
ingress
);
}
TrafficSelector
selector
=
DefaultTrafficSelector
.
builder
()
.
matchEthType
(
Ethernet
.
TYPE_IPV4
)
.
build
();
TrafficSelector
selector
=
buildTrafficSelector
();
TrafficTreatment
treatment
=
DefaultTrafficTreatment
.
builder
().
build
();
Intent
intent
=
new
MultiPointToSinglePointIntent
(
appId
(),
selector
,
treatment
,
...
...
cli/src/main/java/org/onlab/onos/cli/net/AddPointToPointIntentCommand.java
View file @
574afda
/*
* 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.
*/
package
org
.
onlab
.
onos
.
cli
.
net
;
import
org.apache.karaf.shell.commands.Argument
;
import
org.apache.karaf.shell.commands.Command
;
import
org.onlab.onos.cli.AbstractShellCommand
;
import
org.onlab.onos.net.ConnectPoint
;
import
org.onlab.onos.net.DeviceId
;
import
org.onlab.onos.net.PortNumber
;
import
org.onlab.onos.net.flow.DefaultTrafficSelector
;
import
org.onlab.onos.net.flow.DefaultTrafficTreatment
;
import
org.onlab.onos.net.flow.TrafficSelector
;
import
org.onlab.onos.net.flow.TrafficTreatment
;
import
org.onlab.onos.net.intent.Intent
;
import
org.onlab.onos.net.intent.IntentService
;
import
org.onlab.onos.net.intent.PointToPointIntent
;
import
org.onlab.packet.Ethernet
;
import
static
org
.
onlab
.
onos
.
net
.
flow
.
DefaultTrafficTreatment
.
builder
;
import
static
org
.
onlab
.
onos
.
net
.
DeviceId
.
deviceId
;
import
static
org
.
onlab
.
onos
.
net
.
PortNumber
.
portNumber
;
...
...
@@ -23,7 +39,7 @@ import static org.onlab.onos.net.PortNumber.portNumber;
*/
@Command
(
scope
=
"onos"
,
name
=
"add-point-intent"
,
description
=
"Installs point-to-point connectivity intent"
)
public
class
AddPointToPointIntentCommand
extends
AbstractShell
Command
{
public
class
AddPointToPointIntentCommand
extends
ConnectivityIntent
Command
{
@Argument
(
index
=
0
,
name
=
"ingressDevice"
,
description
=
"Ingress Device/Port Description"
,
...
...
@@ -47,10 +63,8 @@ public class AddPointToPointIntentCommand extends AbstractShellCommand {
PortNumber
egressPortNumber
=
portNumber
(
getPortNumber
(
egressDeviceString
));
ConnectPoint
egress
=
new
ConnectPoint
(
egressDeviceId
,
egressPortNumber
);
TrafficSelector
selector
=
DefaultTrafficSelector
.
builder
()
.
matchEthType
(
Ethernet
.
TYPE_IPV4
)
.
build
();
TrafficTreatment
treatment
=
DefaultTrafficTreatment
.
builder
().
build
();
TrafficSelector
selector
=
buildTrafficSelector
();
TrafficTreatment
treatment
=
builder
().
build
();
Intent
intent
=
new
PointToPointIntent
(
appId
(),
selector
,
treatment
,
ingress
,
egress
);
...
...
cli/src/main/java/org/onlab/onos/cli/net/ClusterDevicesCommand.java
View file @
574afda
/*
* 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.
*/
package
org
.
onlab
.
onos
.
cli
.
net
;
import
com.fasterxml.jackson.databind.ObjectMapper
;
...
...
cli/src/main/java/org/onlab/onos/cli/net/ClusterIdCompleter.java
View file @
574afda
/*
* 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.
*/
package
org
.
onlab
.
onos
.
cli
.
net
;
import
org.apache.karaf.shell.console.Completer
;
...
...
cli/src/main/java/org/onlab/onos/cli/net/ClusterLinksCommand.java
View file @
574afda
/*
* 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.
*/
package
org
.
onlab
.
onos
.
cli
.
net
;
import
org.apache.karaf.shell.commands.Argument
;
...
...
cli/src/main/java/org/onlab/onos/cli/net/ClustersListCommand.java
View file @
574afda
/*
* 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.
*/
package
org
.
onlab
.
onos
.
cli
.
net
;
import
com.fasterxml.jackson.databind.JsonNode
;
...
...
cli/src/main/java/org/onlab/onos/cli/net/ConnectPointCompleter.java
View file @
574afda
/*
* 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.
*/
package
org
.
onlab
.
onos
.
cli
.
net
;
import
java.util.List
;
...
...
cli/src/main/java/org/onlab/onos/cli/net/ConnectivityIntentCommand.java
0 → 100644
View file @
574afda
/*
* 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.
*/
package
org
.
onlab
.
onos
.
cli
.
net
;
import
org.apache.karaf.shell.commands.Option
;
import
org.onlab.onos.cli.AbstractShellCommand
;
import
org.onlab.onos.net.flow.DefaultTrafficSelector
;
import
org.onlab.onos.net.flow.TrafficSelector
;
import
org.onlab.packet.Ethernet
;
import
org.onlab.packet.MacAddress
;
import
com.google.common.base.Strings
;
/**
* Base class for command line operations for connectivity based intents.
*/
public
abstract
class
ConnectivityIntentCommand
extends
AbstractShellCommand
{
@Option
(
name
=
"-s"
,
aliases
=
"--ethSrc"
,
description
=
"Source MAC Address"
,
required
=
false
,
multiValued
=
false
)
private
String
srcMacString
=
null
;
@Option
(
name
=
"-d"
,
aliases
=
"--ethDst"
,
description
=
"Destination MAC Address"
,
required
=
false
,
multiValued
=
false
)
private
String
dstMacString
=
null
;
@Option
(
name
=
"-t"
,
aliases
=
"--ethType"
,
description
=
"Ethernet Type"
,
required
=
false
,
multiValued
=
false
)
private
String
ethTypeString
=
""
;
/**
* Constructs a traffic selector based on the command line arguments
* presented to the command.
*/
protected
TrafficSelector
buildTrafficSelector
()
{
TrafficSelector
.
Builder
selectorBuilder
=
DefaultTrafficSelector
.
builder
();
Short
ethType
=
Ethernet
.
TYPE_IPV4
;
if
(!
Strings
.
isNullOrEmpty
(
ethTypeString
))
{
EthType
ethTypeParameter
=
EthType
.
valueOf
(
ethTypeString
);
ethType
=
ethTypeParameter
.
value
();
}
selectorBuilder
.
matchEthType
(
ethType
);
if
(!
Strings
.
isNullOrEmpty
(
srcMacString
))
{
selectorBuilder
.
matchEthSrc
(
MacAddress
.
valueOf
(
srcMacString
));
}
if
(!
Strings
.
isNullOrEmpty
(
dstMacString
))
{
selectorBuilder
.
matchEthDst
(
MacAddress
.
valueOf
(
dstMacString
));
}
return
selectorBuilder
.
build
();
}
}
cli/src/main/java/org/onlab/onos/cli/net/DeviceIdCompleter.java
View file @
574afda
/*
* 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.
*/
package
org
.
onlab
.
onos
.
cli
.
net
;
import
org.apache.karaf.shell.console.Completer
;
...
...
cli/src/main/java/org/onlab/onos/cli/net/DevicePortsListCommand.java
View file @
574afda
/*
* 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.
*/
package
org
.
onlab
.
onos
.
cli
.
net
;
import
com.fasterxml.jackson.databind.JsonNode
;
...
...
cli/src/main/java/org/onlab/onos/cli/net/DeviceRemoveCommand.java
View file @
574afda
/*
* 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.
*/
package
org
.
onlab
.
onos
.
cli
.
net
;
import
org.apache.karaf.shell.commands.Argument
;
...
...
cli/src/main/java/org/onlab/onos/cli/net/DeviceRoleCommand.java
View file @
574afda
/*
* 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.
*/
package
org
.
onlab
.
onos
.
cli
.
net
;
import
org.apache.karaf.shell.commands.Argument
;
...
...
cli/src/main/java/org/onlab/onos/cli/net/DevicesListCommand.java
View file @
574afda
/*
* 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.
*/
package
org
.
onlab
.
onos
.
cli
.
net
;
import
com.fasterxml.jackson.databind.JsonNode
;
...
...
cli/src/main/java/org/onlab/onos/cli/net/EthType.java
0 → 100644
View file @
574afda
/*
* 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.
*/
package
org
.
onlab
.
onos
.
cli
.
net
;
import
org.onlab.packet.Ethernet
;
/**
* Allowed values for Ethernet types. Used by the CLI completer for
* connectivity based intent L2 parameters.
*/
public
enum
EthType
{
/** ARP. */
ARP
(
Ethernet
.
TYPE_ARP
),
/** RARP. */
RARP
(
Ethernet
.
TYPE_RARP
),
/** IPV4. */
IPV4
(
Ethernet
.
TYPE_IPV4
),
/** LLDP. */
LLDP
(
Ethernet
.
TYPE_LLDP
),
/** BSN. */
BSN
(
Ethernet
.
TYPE_BSN
);
private
short
value
;
/**
* Constructs an EthType with the given value.
*
* @param value value to use when this EthType is seen.
*/
private
EthType
(
short
value
)
{
this
.
value
=
value
;
}
/**
* Gets the value to use for this EthType.
*
* @return short value to use for this EthType
*/
public
short
value
()
{
return
this
.
value
;
}
}
cli/src/main/java/org/onlab/onos/cli/net/EthTypeCompleter.java
0 → 100644
View file @
574afda
/*
* 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.
*/
package
org
.
onlab
.
onos
.
cli
.
net
;
import
java.util.List
;
import
java.util.SortedSet
;
import
org.apache.karaf.shell.console.Completer
;
import
org.apache.karaf.shell.console.completer.StringsCompleter
;
/**
* Ethernet type completer.
*/
public
class
EthTypeCompleter
implements
Completer
{
@Override
public
int
complete
(
String
buffer
,
int
cursor
,
List
<
String
>
candidates
)
{
// Delegate string completer
StringsCompleter
delegate
=
new
StringsCompleter
();
SortedSet
<
String
>
strings
=
delegate
.
getStrings
();
strings
.
add
(
EthType
.
ARP
.
toString
());
strings
.
add
(
EthType
.
BSN
.
toString
());
strings
.
add
(
EthType
.
IPV4
.
toString
());
strings
.
add
(
EthType
.
LLDP
.
toString
());
strings
.
add
(
EthType
.
RARP
.
toString
());
// Now let the completer do the work for figuring out what to offer.
return
delegate
.
complete
(
buffer
,
cursor
,
candidates
);
}
}
cli/src/main/java/org/onlab/onos/cli/net/FlowRuleStatusCompleter.java
View file @
574afda
/*
* 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.
*/
package
org
.
onlab
.
onos
.
cli
.
net
;
import
java.util.List
;
...
...
cli/src/main/java/org/onlab/onos/cli/net/FlowsListCommand.java
View file @
574afda
/*
* 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.
*/
package
org
.
onlab
.
onos
.
cli
.
net
;
import
com.fasterxml.jackson.databind.JsonNode
;
...
...
cli/src/main/java/org/onlab/onos/cli/net/HostIdCompleter.java
View file @
574afda
/*
* 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.
*/
package
org
.
onlab
.
onos
.
cli
.
net
;
import
java.util.Iterator
;
...
...
cli/src/main/java/org/onlab/onos/cli/net/HostsListCommand.java
View file @
574afda
/*
* 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.
*/
package
org
.
onlab
.
onos
.
cli
.
net
;
import
com.fasterxml.jackson.databind.JsonNode
;
...
...
cli/src/main/java/org/onlab/onos/cli/net/IntentIdCompleter.java
View file @
574afda
/*
* 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.
*/
package
org
.
onlab
.
onos
.
cli
.
net
;
import
org.apache.karaf.shell.console.Completer
;
...
...
cli/src/main/java/org/onlab/onos/cli/net/IntentPushTestCommand.java
View file @
574afda
/*
* 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.
*/
package
org
.
onlab
.
onos
.
cli
.
net
;
import
org.apache.karaf.shell.commands.Argument
;
...
...
cli/src/main/java/org/onlab/onos/cli/net/IntentRemoveCommand.java
View file @
574afda
/*
* 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.
*/
package
org
.
onlab
.
onos
.
cli
.
net
;
import
org.apache.karaf.shell.commands.Argument
;
...
...
cli/src/main/java/org/onlab/onos/cli/net/IntentsListCommand.java
View file @
574afda
/*
* 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.
*/
package
org
.
onlab
.
onos
.
cli
.
net
;
import
com.fasterxml.jackson.databind.JsonNode
;
...
...
cli/src/main/java/org/onlab/onos/cli/net/LinksListCommand.java
View file @
574afda
/*
* 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.
*/
package
org
.
onlab
.
onos
.
cli
.
net
;
import
com.fasterxml.jackson.databind.JsonNode
;
...
...
cli/src/main/java/org/onlab/onos/cli/net/PathListCommand.java
View file @
574afda
/*
* 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.
*/
package
org
.
onlab
.
onos
.
cli
.
net
;
import
com.fasterxml.jackson.databind.JsonNode
;
...
...
cli/src/main/java/org/onlab/onos/cli/net/RoleCompleter.java
View file @
574afda
/*
* 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.
*/
package
org
.
onlab
.
onos
.
cli
.
net
;
import
org.apache.karaf.shell.console.Completer
;
...
...
cli/src/main/java/org/onlab/onos/cli/net/TopologyCommand.java
View file @
574afda
/*
* 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.
*/
package
org
.
onlab
.
onos
.
cli
.
net
;
import
com.fasterxml.jackson.databind.ObjectMapper
;
...
...
cli/src/main/java/org/onlab/onos/cli/net/WipeOutCommand.java
View file @
574afda
/*
* 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.
*/
package
org
.
onlab
.
onos
.
cli
.
net
;
import
org.apache.karaf.shell.commands.Argument
;
...
...
cli/src/main/java/org/onlab/onos/cli/net/package-info.java
View file @
574afda
/*
* 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.
*/
/**
* Administrative console command-line extensions for interacting with the
* network model & services.
...
...
cli/src/main/java/org/onlab/onos/cli/package-info.java
View file @
574afda
/*
* 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.
*/
/**
* Administrative console command-line extensions.
*/
...
...
cli/src/main/resources/OSGI-INF/blueprint/shell-config.xml
View file @
574afda
<!--
~ 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.
-->
<blueprint
xmlns=
"http://www.osgi.org/xmlns/blueprint/v1.0.0"
>
<command-bundle
xmlns=
"http://karaf.apache.org/xmlns/shell/v1.1.0"
>
...
...
@@ -96,12 +114,18 @@
<ref
component-id=
"connectPointCompleter"
/>
<null/>
</completers>
<optional-completers>
<entry
key=
"-t"
value-ref=
"ethTypeCompleter"
/>
</optional-completers>
</command>
<command>
<action
class=
"org.onlab.onos.cli.net.AddMultiPointToSinglePointIntentCommand"
/>
<completers>
<ref
component-id=
"connectPointCompleter"
/>
</completers>
<optional-completers>
<entry
key=
"-t"
value-ref=
"ethTypeCompleter"
/>
</optional-completers>
</command>
<command>
<action
class=
"org.onlab.onos.cli.net.IntentPushTestCommand"
/>
...
...
@@ -158,5 +182,6 @@
<bean
id=
"flowRuleStatusCompleter"
class=
"org.onlab.onos.cli.net.FlowRuleStatusCompleter"
/>
<bean
id=
"connectPointCompleter"
class=
"org.onlab.onos.cli.net.ConnectPointCompleter"
/>
<bean
id=
"nullCompleter"
class=
"org.apache.karaf.shell.console.completer.NullCompleter"
/>
<bean
id=
"ethTypeCompleter"
class=
"org.onlab.onos.cli.net.EthTypeCompleter"
/>
</blueprint>
...
...
core/api/src/main/java/org/onlab/onos/event/AbstractListenerRegistry.java
View file @
574afda
...
...
@@ -19,6 +19,7 @@ public class AbstractListenerRegistry<E extends Event, L extends EventListener<E
private
final
Logger
log
=
getLogger
(
getClass
());
private
final
Set
<
L
>
listeners
=
new
CopyOnWriteArraySet
<>();
private
volatile
boolean
shutdown
=
false
;
/**
* Adds the specified listener.
...
...
@@ -58,7 +59,24 @@ public class AbstractListenerRegistry<E extends Event, L extends EventListener<E
* @param error error encountered while processing
*/
protected
void
reportProblem
(
E
event
,
Throwable
error
)
{
log
.
warn
(
"Exception encountered while processing event "
+
event
,
error
);
if
(!
shutdown
)
{
log
.
warn
(
"Exception encountered while processing event "
+
event
,
error
);
}
}
/**
* Prepares the registry for normal operation.
*/
public
void
activate
()
{
shutdown
=
false
;
}
/**
* Prepares the registry for shutdown.
*/
public
void
deactivate
()
{
shutdown
=
true
;
}
}
...
...
core/api/src/main/java/org/onlab/onos/net/flow/DefaultTrafficTreatment.java
View file @
574afda
...
...
@@ -44,6 +44,16 @@ public final class DefaultTrafficTreatment implements TrafficTreatment {
return
new
Builder
();
}
/**
* Returns a new traffic treatment builder primed to produce entities
* patterned after the supplied treatment.
*
* @return traffic treatment builder
*/
public
static
TrafficTreatment
.
Builder
builder
(
TrafficTreatment
treatment
)
{
return
new
Builder
(
treatment
);
}
//FIXME: Order of instructions may affect hashcode
@Override
public
int
hashCode
()
{
...
...
@@ -90,6 +100,13 @@ public final class DefaultTrafficTreatment implements TrafficTreatment {
private
Builder
()
{
}
// Creates a new builder based off an existing treatment
private
Builder
(
TrafficTreatment
treatment
)
{
for
(
Instruction
instruction
:
treatment
.
instructions
())
{
add
(
instruction
);
}
}
@Override
public
Builder
add
(
Instruction
instruction
)
{
if
(
drop
)
{
...
...
core/api/src/main/java/org/onlab/onos/net/intent/HostToHostIntent.java
View file @
574afda
...
...
@@ -41,7 +41,7 @@ public final class HostToHostIntent extends ConnectivityIntent {
}
private
static
HostId
max
(
HostId
one
,
HostId
two
)
{
return
one
.
hashCode
()
>
two
.
hashCode
()
?
one
:
two
;
return
one
.
hashCode
()
>
=
two
.
hashCode
()
?
one
:
two
;
}
/**
...
...
core/api/src/main/java/org/onlab/onos/net/intent/Intent.java
View file @
574afda
...
...
@@ -37,8 +37,8 @@ public abstract class Intent implements BatchOperationTarget {
*/
protected
Intent
(
IntentId
id
,
ApplicationId
appId
,
Collection
<
NetworkResource
>
resources
)
{
this
.
id
=
checkNotNull
(
id
,
"Intent ID cannot be null"
);
this
.
appId
=
checkNotNull
(
appId
,
"Application ID cannot be null"
);
this
.
id
=
checkNotNull
(
id
,
"Fingerprint cannot be null"
);
this
.
resources
=
resources
;
}
...
...
@@ -77,6 +77,7 @@ public abstract class Intent implements BatchOperationTarget {
* @return intent identifier
*/
protected
static
IntentId
id
(
Object
...
fields
)
{
// FIXME: spread the bits across the full long spectrum
return
IntentId
.
valueOf
(
Objects
.
hash
(
fields
));
}
...
...
@@ -90,12 +91,12 @@ public abstract class Intent implements BatchOperationTarget {
}
@Override
public
int
hashCode
()
{
public
final
int
hashCode
()
{
return
Objects
.
hash
(
id
);
}
@Override
public
boolean
equals
(
Object
obj
)
{
public
final
boolean
equals
(
Object
obj
)
{
if
(
this
==
obj
)
{
return
true
;
}
...
...
core/net/src/main/java/org/onlab/onos/net/intent/impl/LinkCollectionIntentInstaller.java
View file @
574afda
package
org
.
onlab
.
onos
.
net
.
intent
.
impl
;
import
static
org
.
onlab
.
onos
.
net
.
flow
.
DefaultTrafficTreatment
.
builder
;
import
static
org
.
slf4j
.
LoggerFactory
.
getLogger
;
import
java.util.List
;
...
...
@@ -17,6 +16,7 @@ import org.onlab.onos.net.Link;
import
org.onlab.onos.net.PortNumber
;
import
org.onlab.onos.net.flow.DefaultFlowRule
;
import
org.onlab.onos.net.flow.DefaultTrafficSelector
;
import
org.onlab.onos.net.flow.DefaultTrafficTreatment
;
import
org.onlab.onos.net.flow.FlowRule
;
import
org.onlab.onos.net.flow.FlowRuleBatchEntry
;
import
org.onlab.onos.net.flow.FlowRuleBatchEntry.FlowRuleOperation
;
...
...
@@ -61,18 +61,16 @@ public class LinkCollectionIntentInstaller implements IntentInstaller<LinkCollec
@Override
public
List
<
FlowRuleBatchOperation
>
install
(
LinkCollectionIntent
intent
)
{
TrafficSelector
.
Builder
builder
=
DefaultTrafficSelector
.
builder
(
intent
.
selector
());
List
<
FlowRuleBatchEntry
>
rules
=
Lists
.
newLinkedList
();
for
(
Link
link
:
intent
.
links
())
{
rules
.
add
(
createBatchEntry
(
FlowRuleOperation
.
ADD
,
builder
.
build
()
,
intent
,
link
.
src
().
deviceId
(),
link
.
src
().
port
()));
}
rules
.
add
(
createBatchEntry
(
FlowRuleOperation
.
ADD
,
builder
.
build
()
,
intent
,
intent
.
egressPoint
().
deviceId
(),
intent
.
egressPoint
().
port
()));
...
...
@@ -81,19 +79,17 @@ public class LinkCollectionIntentInstaller implements IntentInstaller<LinkCollec
@Override
public
List
<
FlowRuleBatchOperation
>
uninstall
(
LinkCollectionIntent
intent
)
{
TrafficSelector
.
Builder
builder
=
DefaultTrafficSelector
.
builder
(
intent
.
selector
());
List
<
FlowRuleBatchEntry
>
rules
=
Lists
.
newLinkedList
();
for
(
Link
link
:
intent
.
links
())
{
rules
.
add
(
createBatchEntry
(
FlowRuleOperation
.
REMOVE
,
builder
.
build
()
,
intent
,
link
.
src
().
deviceId
(),
link
.
src
().
port
()));
}
rules
.
add
(
createBatchEntry
(
FlowRuleOperation
.
REMOVE
,
builder
.
build
()
,
intent
,
intent
.
egressPoint
().
deviceId
(),
intent
.
egressPoint
().
port
()));
...
...
@@ -104,17 +100,23 @@ public class LinkCollectionIntentInstaller implements IntentInstaller<LinkCollec
* Creates a FlowRuleBatchEntry based on the provided parameters.
*
* @param operation the FlowRuleOperation to use
* @param
selector the traffic selector
* @param
intent the link collection intent
* @param deviceId the device ID for the flow rule
* @param outPort the output port of the flow rule
* @return the new flow rule batch entry
*/
private
FlowRuleBatchEntry
createBatchEntry
(
FlowRuleOperation
operation
,
TrafficSelector
selector
,
LinkCollectionIntent
intent
,
DeviceId
deviceId
,
PortNumber
outPort
)
{
TrafficTreatment
treatment
=
builder
().
setOutput
(
outPort
).
build
();
TrafficTreatment
.
Builder
treatmentBuilder
=
DefaultTrafficTreatment
.
builder
(
intent
.
treatment
());
TrafficTreatment
treatment
=
treatmentBuilder
.
setOutput
(
outPort
).
build
();
TrafficSelector
selector
=
DefaultTrafficSelector
.
builder
(
intent
.
selector
())
.
build
();
FlowRule
rule
=
new
DefaultFlowRule
(
deviceId
,
selector
,
treatment
,
123
,
appId
,
0
,
true
);
...
...
core/store/dist/src/main/java/org/onlab/onos/store/cluster/messaging/impl/ClusterCommunicationManager.java
View file @
574afda
...
...
@@ -67,7 +67,7 @@ public class ClusterCommunicationManager
@Activate
public
void
activate
()
{
ControllerNode
localNode
=
clusterService
.
getLocalNode
();
NettyMessagingService
netty
=
new
NettyMessagingService
(
localNode
.
tcpPort
());
NettyMessagingService
netty
=
new
NettyMessagingService
(
localNode
.
ip
().
toString
(),
localNode
.
tcpPort
());
// FIXME: workaround until it becomes a service.
try
{
netty
.
activate
();
...
...
core/store/dist/src/main/java/org/onlab/onos/store/link/impl/GossipLinkStore.java
View file @
574afda
...
...
@@ -23,9 +23,9 @@ import org.onlab.onos.net.DefaultAnnotations;
import
org.onlab.onos.net.DefaultLink
;
import
org.onlab.onos.net.DeviceId
;
import
org.onlab.onos.net.Link
;
import
org.onlab.onos.net.SparseAnnotations
;
import
org.onlab.onos.net.Link.Type
;
import
org.onlab.onos.net.LinkKey
;
import
org.onlab.onos.net.SparseAnnotations
;
import
org.onlab.onos.net.device.DeviceClockService
;
import
org.onlab.onos.net.link.DefaultLinkDescription
;
import
org.onlab.onos.net.link.LinkDescription
;
...
...
@@ -266,8 +266,8 @@ public class GossipLinkStore
ProviderId
providerId
,
Timestamped
<
LinkDescription
>
linkDescription
)
{
LinkKey
key
=
linkKey
(
linkDescription
.
value
().
src
(),
linkDescription
.
value
().
dst
());
final
LinkKey
key
=
linkKey
(
linkDescription
.
value
().
src
(),
linkDescription
.
value
().
dst
());
Map
<
ProviderId
,
Timestamped
<
LinkDescription
>>
descs
=
getOrCreateLinkDescriptions
(
key
);
synchronized
(
descs
)
{
...
...
@@ -278,6 +278,7 @@ public class GossipLinkStore
if
(
linkDescription
.
isNewer
(
linkRemovedTimestamp
))
{
removedLinks
.
remove
(
key
);
}
else
{
log
.
trace
(
"Link {} was already removed ignoring."
,
key
);
return
null
;
}
}
...
...
@@ -302,17 +303,25 @@ public class GossipLinkStore
// merge existing annotations
Timestamped
<
LinkDescription
>
existingLinkDescription
=
descs
.
get
(
providerId
);
if
(
existingLinkDescription
!=
null
&&
existingLinkDescription
.
isNewer
(
linkDescription
))
{
log
.
trace
(
"local info is more up-to-date, ignoring {}."
,
linkDescription
);
return
null
;
}
Timestamped
<
LinkDescription
>
newLinkDescription
=
linkDescription
;
if
(
existingLinkDescription
!=
null
)
{
// we only allow transition from INDIRECT -> DIRECT
final
Type
newType
;
if
(
existingLinkDescription
.
value
().
type
()
==
DIRECT
)
{
newType
=
DIRECT
;
}
else
{
newType
=
linkDescription
.
value
().
type
();
}
SparseAnnotations
merged
=
union
(
existingLinkDescription
.
value
().
annotations
(),
linkDescription
.
value
().
annotations
());
newLinkDescription
=
new
Timestamped
<
LinkDescription
>(
new
DefaultLinkDescription
(
linkDescription
.
value
().
src
(),
linkDescription
.
value
().
dst
(),
linkDescription
.
value
().
type
()
,
merged
),
newType
,
merged
),
linkDescription
.
timestamp
());
}
return
descs
.
put
(
providerId
,
newLinkDescription
);
...
...
@@ -346,6 +355,8 @@ public class GossipLinkStore
return
null
;
}
// Note: INDIRECT -> DIRECT transition only
// so that BDDP discovered Link will not overwrite LDDP Link
if
((
oldLink
.
type
()
==
INDIRECT
&&
newLink
.
type
()
==
DIRECT
)
||
!
AnnotationsUtil
.
isEqual
(
oldLink
.
annotations
(),
newLink
.
annotations
()))
{
...
...
core/store/trivial/src/main/java/org/onlab/onos/store/trivial/impl/SimpleLinkStore.java
View file @
574afda
...
...
@@ -172,12 +172,19 @@ public class SimpleLinkStore
LinkDescription
oldDesc
=
descs
.
get
(
providerId
);
LinkDescription
newDesc
=
linkDescription
;
if
(
oldDesc
!=
null
)
{
// we only allow transition from INDIRECT -> DIRECT
final
Type
newType
;
if
(
oldDesc
.
type
()
==
DIRECT
)
{
newType
=
DIRECT
;
}
else
{
newType
=
linkDescription
.
type
();
}
SparseAnnotations
merged
=
union
(
oldDesc
.
annotations
(),
linkDescription
.
annotations
());
newDesc
=
new
DefaultLinkDescription
(
linkDescription
.
src
(),
linkDescription
.
dst
(),
linkDescription
.
type
()
,
merged
);
newType
,
merged
);
}
return
descs
.
put
(
providerId
,
newDesc
);
}
...
...
features/features.xml
View file @
574afda
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<!--
~ 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.
-->
<features
xmlns=
"http://karaf.apache.org/xmlns/features/v1.2.0"
name=
"onos-1.0.0"
>
<repository>
mvn:org.onlab.onos/onos-features/1.0.0-SNAPSHOT/xml/features
</repository>
<repository>
mvn:org.onlab.onos/onos-features/1.0.0-SNAPSHOT/xml/features
</repository>
<feature
name=
"onos-thirdparty-base"
version=
"1.0.0"
description=
"ONOS 3rd party dependencies"
>
...
...
@@ -15,6 +32,7 @@
<bundle>
mvn:io.netty/netty-transport/4.0.23.Final
</bundle>
<bundle>
mvn:io.netty/netty-handler/4.0.23.Final
</bundle>
<bundle>
mvn:io.netty/netty-codec/4.0.23.Final
</bundle>
<bundle>
mvn:io.netty/netty-transport-native-epoll/4.0.23.Final
</bundle>
<bundle>
mvn:commons-pool/commons-pool/1.6
</bundle>
<bundle>
mvn:com.hazelcast/hazelcast/3.3
</bundle>
...
...
pom.xml
View file @
574afda
...
...
@@ -312,6 +312,11 @@
<artifactId>
netty-codec
</artifactId>
<version>
${netty4.version}
</version>
</dependency>
<dependency>
<groupId>
io.netty
</groupId>
<artifactId>
netty-transport-native-epoll
</artifactId>
<version>
${netty4.version}
</version>
</dependency>
</dependencies>
</dependencyManagement>
...
...
tools/test/bin/onos-install
View file @
574afda
...
...
@@ -6,8 +6,17 @@
[
! -d
"
$ONOS_ROOT
"
]
&&
echo
"ONOS_ROOT is not defined"
>&2
&&
exit
1
.
$ONOS_ROOT
/tools/build/envDefaults
# If the first option is -f attempt uninstall first.
[
"
$1
"
=
"-f"
]
&&
shift
&&
onos-uninstall
${
1
:-
$OCI
}
while
getopts
fn o;
do
case
"
$o
"
in
f
)
uninstall
=
true
;;
n
)
nostart
=
true
;;
esac
done
let
OPC
=
$OPTIND
-1
shift
$OPC
# If the -f was given, attempt uninstall first.
[
-n
"
$uninstall
"
]
&&
onos-uninstall
${
1
:-
$OCI
}
node
=
${
1
:-
$OCI
}
remote
=
$ONOS_USER
@
$node
...
...
@@ -27,19 +36,20 @@ ssh $remote "
mkdir
$ONOS_INSTALL_DIR
/config
# Install the upstart configuration file and setup options for debugging
sudo cp
$ONOS_INSTALL_DIR
/debian/onos.conf /etc/init/onos.conf
[ -z "
$nostart
" ] &&
sudo cp
$ONOS_INSTALL_DIR
/debian/onos.conf /etc/init/onos.conf
echo 'export ONOS_OPTS=debug' >
$ONOS_INSTALL_DIR
/options
# Remove any previous ON.Lab bits from ~/.m2 repo
rm -fr ~/.m2/repository/org/onlab
# Drop log level for the console
echo "
log4j.logger.org.apache.sshd
=
WARN
" >>
$ONOS_INSTALL_DIR
/
$KARAF_DIST
/etc/org.ops4j.pax.logging.cfg
echo "
log4j.logger.org.apache.sshd
=
WARN
"
\
>>
$ONOS_INSTALL_DIR
/
$KARAF_DIST
/etc/org.ops4j.pax.logging.cfg
"
# Configure the ONOS installation
onos-config
$node
#
I
gnite the ONOS service.
onos-service
$node
start
#
Unless -n option was given, attempt to i
gnite the ONOS service.
[
-z
"
$nostart
"
]
&&
onos-service
$node
start
...
...
utils/netty/pom.xml
View file @
574afda
...
...
@@ -55,6 +55,10 @@
<groupId>
io.netty
</groupId>
<artifactId>
netty-codec
</artifactId>
</dependency>
<dependency>
<groupId>
io.netty
</groupId>
<artifactId>
netty-transport-native-epoll
</artifactId>
</dependency>
</dependencies>
</project>
...
...
utils/netty/src/main/java/org/onlab/netty/InternalMessage.java
View file @
574afda
...
...
@@ -44,8 +44,7 @@ public final class InternalMessage implements Message {
public
void
respond
(
byte
[]
data
)
throws
IOException
{
Builder
builder
=
new
Builder
(
messagingService
);
InternalMessage
message
=
builder
.
withId
(
this
.
id
)
// FIXME: Sender should be messagingService.localEp.
.
withSender
(
this
.
sender
)
.
withSender
(
messagingService
.
localEp
())
.
withPayload
(
data
)
.
withType
(
REPLY_MESSAGE_TYPE
)
.
build
();
...
...
utils/netty/src/main/java/org/onlab/netty/NettyMessagingService.java
View file @
574afda
...
...
@@ -16,7 +16,11 @@ import io.netty.channel.ChannelHandlerContext;
import
io.netty.channel.ChannelInitializer
;
import
io.netty.channel.ChannelOption
;
import
io.netty.channel.EventLoopGroup
;
import
io.netty.channel.ServerChannel
;
import
io.netty.channel.SimpleChannelInboundHandler
;
import
io.netty.channel.epoll.EpollEventLoopGroup
;
import
io.netty.channel.epoll.EpollServerSocketChannel
;
import
io.netty.channel.epoll.EpollSocketChannel
;
import
io.netty.channel.nio.NioEventLoopGroup
;
import
io.netty.channel.socket.SocketChannel
;
import
io.netty.channel.socket.nio.NioServerSocketChannel
;
...
...
@@ -38,11 +42,7 @@ public class NettyMessagingService implements MessagingService {
private
final
Logger
log
=
LoggerFactory
.
getLogger
(
getClass
());
private
final
int
port
;
private
final
Endpoint
localEp
;
private
final
EventLoopGroup
bossGroup
=
new
NioEventLoopGroup
();
private
EventLoopGroup
workerGroup
;
private
Class
<?
extends
Channel
>
channelClass
;
private
final
ConcurrentMap
<
String
,
MessageHandler
>
handlers
=
new
ConcurrentHashMap
<>();
private
final
Cache
<
Long
,
AsyncResponse
>
responseFutures
=
CacheBuilder
.
newBuilder
()
.
maximumSize
(
100000
)
...
...
@@ -53,10 +53,31 @@ public class NettyMessagingService implements MessagingService {
private
final
GenericKeyedObjectPool
<
Endpoint
,
Channel
>
channels
=
new
GenericKeyedObjectPool
<
Endpoint
,
Channel
>(
new
OnosCommunicationChannelFactory
());
// TODO: make this configurable.
private
EventLoopGroup
serverGroup
;
private
EventLoopGroup
clientGroup
;
private
Class
<?
extends
ServerChannel
>
serverChannelClass
;
private
Class
<?
extends
Channel
>
clientChannelClass
;
private
void
initEventLoopGroup
()
{
workerGroup
=
new
NioEventLoopGroup
();
channelClass
=
NioSocketChannel
.
class
;
// try Epoll first and if that does work, use nio.
// TODO: make this configurable.
try
{
clientGroup
=
new
EpollEventLoopGroup
();
serverGroup
=
new
EpollEventLoopGroup
();
serverChannelClass
=
EpollServerSocketChannel
.
class
;
clientChannelClass
=
EpollSocketChannel
.
class
;
return
;
}
catch
(
Throwable
t
)
{
log
.
warn
(
"Failed to initialize native (epoll) transport. Proceeding with nio."
,
t
);
}
clientGroup
=
new
NioEventLoopGroup
();
serverGroup
=
new
NioEventLoopGroup
();
serverChannelClass
=
NioServerSocketChannel
.
class
;
clientChannelClass
=
NioSocketChannel
.
class
;
}
public
NettyMessagingService
(
String
ip
,
int
port
)
{
localEp
=
new
Endpoint
(
ip
,
port
);
}
public
NettyMessagingService
()
{
...
...
@@ -66,7 +87,6 @@ public class NettyMessagingService implements MessagingService {
// FIXME: Constructor should not throw exceptions.
public
NettyMessagingService
(
int
port
)
{
this
.
port
=
port
;
try
{
localEp
=
new
Endpoint
(
java
.
net
.
InetAddress
.
getLocalHost
().
getHostName
(),
port
);
}
catch
(
UnknownHostException
e
)
{
...
...
@@ -84,8 +104,16 @@ public class NettyMessagingService implements MessagingService {
public
void
deactivate
()
throws
Exception
{
channels
.
close
();
bossGroup
.
shutdownGracefully
();
workerGroup
.
shutdownGracefully
();
serverGroup
.
shutdownGracefully
();
clientGroup
.
shutdownGracefully
();
}
/**
* Returns the local endpoint for this instance.
* @return local end point.
*/
public
Endpoint
localEp
()
{
return
localEp
;
}
@Override
...
...
@@ -109,7 +137,7 @@ public class NettyMessagingService implements MessagingService {
channels
.
returnObject
(
ep
,
channel
);
}
}
catch
(
Exception
e
)
{
throw
new
IOException
(
e
);
throw
new
IOException
(
"Failed to send message to "
+
ep
.
toString
(),
e
);
}
}
...
...
@@ -149,14 +177,14 @@ public class NettyMessagingService implements MessagingService {
b
.
option
(
ChannelOption
.
WRITE_BUFFER_LOW_WATER_MARK
,
8
*
1024
);
// TODO: Need JVM options to configure PooledByteBufAllocator.
b
.
option
(
ChannelOption
.
ALLOCATOR
,
PooledByteBufAllocator
.
DEFAULT
);
b
.
group
(
bossGroup
,
worker
Group
)
.
channel
(
NioServerSocketChannel
.
c
lass
)
b
.
group
(
serverGroup
,
client
Group
)
.
channel
(
serverChannelC
lass
)
.
childHandler
(
new
OnosCommunicationChannelInitializer
())
.
option
(
ChannelOption
.
SO_BACKLOG
,
128
)
.
childOption
(
ChannelOption
.
SO_KEEPALIVE
,
true
);
// Bind and start to accept incoming connections.
b
.
bind
(
port
).
sync
();
b
.
bind
(
localEp
.
port
()
).
sync
();
}
private
class
OnosCommunicationChannelFactory
...
...
@@ -178,10 +206,10 @@ public class NettyMessagingService implements MessagingService {
bootstrap
.
option
(
ChannelOption
.
ALLOCATOR
,
PooledByteBufAllocator
.
DEFAULT
);
bootstrap
.
option
(
ChannelOption
.
WRITE_BUFFER_HIGH_WATER_MARK
,
32
*
1024
);
bootstrap
.
option
(
ChannelOption
.
WRITE_BUFFER_LOW_WATER_MARK
,
8
*
1024
);
bootstrap
.
group
(
worker
Group
);
bootstrap
.
group
(
client
Group
);
// TODO: Make this faster:
// http://normanmaurer.me/presentations/2014-facebook-eng-netty/slides.html#37.0
bootstrap
.
channel
(
channelClass
);
bootstrap
.
channel
(
c
lientC
hannelClass
);
bootstrap
.
option
(
ChannelOption
.
SO_KEEPALIVE
,
true
);
bootstrap
.
handler
(
new
OnosCommunicationChannelInitializer
());
// Start the client.
...
...
Please
register
or
login
to post a comment