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-09-03 14:46:17 -0700
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
6f5460bb79fcd1d966079cb0612048ca827cd36b
6f5460bb
1 parent
3b746c6d
graceful shutdown
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
87 additions
and
15 deletions
of/api/src/main/java/org/onlab/onos/of/controller/OpenFlowSwitch.java
of/api/src/main/java/org/onlab/onos/of/controller/driver/AbstractOpenFlowSwitch.java
of/ctl/src/main/java/org/onlab/onos/of/controller/impl/Controller.java
of/ctl/src/main/java/org/onlab/onos/of/controller/impl/OFChannelHandler.java
providers/of/device/src/main/java/org/onlab/onos/provider/of/device/impl/OpenFlowDeviceProvider.java
of/api/src/main/java/org/onlab/onos/of/controller/OpenFlowSwitch.java
View file @
6f5460b
...
...
@@ -70,6 +70,36 @@ public interface OpenFlowSwitch {
public
long
getId
();
/**
* fetch the manufacturer description.
* @return the description
*/
public
String
manfacturerDescription
();
/**
* fetch the datapath description.
* @return the description
*/
public
String
datapathDescription
();
/**
* fetch the hardware description.
* @return the description
*/
public
String
hardwareDescription
();
/**
* fetch the software description.
* @return the description
*/
public
String
softwareDescription
();
/**
* fetch the serial number.
* @return the serial
*/
public
String
serialNumber
();
/**
* Disconnects the switch by closing the TCP connection. Results in a call
* to the channel handler's channelDisconnected method for cleanup
*/
...
...
of/api/src/main/java/org/onlab/onos/of/controller/driver/AbstractOpenFlowSwitch.java
View file @
6f5460b
...
...
@@ -311,4 +311,31 @@ public abstract class AbstractOpenFlowSwitch implements OpenFlowSwitchDriver {
return
Collections
.
unmodifiableList
(
ports
.
getEntries
());
}
@Override
public
String
manfacturerDescription
()
{
return
this
.
desc
.
getMfrDesc
();
}
@Override
public
String
datapathDescription
()
{
return
this
.
desc
.
getDpDesc
();
}
@Override
public
String
hardwareDescription
()
{
return
this
.
desc
.
getHwDesc
();
}
@Override
public
String
softwareDescription
()
{
return
this
.
desc
.
getSwDesc
();
}
@Override
public
String
serialNumber
()
{
return
this
.
desc
.
getSerialNum
();
}
}
...
...
of/ctl/src/main/java/org/onlab/onos/of/controller/impl/Controller.java
View file @
6f5460b
...
...
@@ -74,6 +74,8 @@ public class Controller {
protected
boolean
alwaysClearFlowsOnSwAdd
=
false
;
private
OpenFlowAgent
agent
;
private
NioServerSocketChannelFactory
execFactory
;
// Perf. related configuration
protected
static
final
int
SEND_BUFFER_SIZE
=
4
*
1024
*
1024
;
protected
static
final
int
BATCH_MAX_SIZE
=
100
;
...
...
@@ -155,16 +157,17 @@ public class Controller {
}
private
ServerBootstrap
createServerBootStrap
()
{
if
(
workerThreads
==
0
)
{
return
new
ServerBootstrap
(
new
NioServerSocketChannelFactory
(
execFactory
=
new
NioServerSocketChannelFactory
(
Executors
.
newCachedThreadPool
(),
Executors
.
newCachedThreadPool
()));
Executors
.
newCachedThreadPool
());
return
new
ServerBootstrap
(
execFactory
);
}
else
{
return
new
ServerBootstrap
(
new
NioServerSocketChannelFactory
(
execFactory
=
new
NioServerSocketChannelFactory
(
Executors
.
newCachedThreadPool
(),
Executors
.
newCachedThreadPool
(),
workerThreads
));
Executors
.
newCachedThreadPool
(),
workerThreads
);
return
new
ServerBootstrap
(
execFactory
);
}
}
...
...
@@ -237,6 +240,7 @@ public class Controller {
public
void
stop
()
{
execFactory
.
shutdown
();
cg
.
close
();
}
...
...
of/ctl/src/main/java/org/onlab/onos/of/controller/impl/OFChannelHandler.java
View file @
6f5460b
...
...
@@ -435,8 +435,8 @@ class OFChannelHandler extends IdleStateAwareChannelHandler {
log
.
debug
(
"Setting new switch {} to EQUAL and sending Role request"
,
h
.
sw
.
getStringId
());
h
.
sw
.
activateEqualSwitch
();
//
h.setSwitchRole(RoleState.EQUAL);
h
.
setSwitchRole
(
RoleState
.
MASTER
);
h
.
setSwitchRole
(
RoleState
.
EQUAL
);
h
.
sw
.
startDriverHandshake
();
h
.
setState
(
WAIT_SWITCH_DRIVER_SUB_HANDSHAKE
);
...
...
providers/of/device/src/main/java/org/onlab/onos/provider/of/device/impl/OpenFlowDeviceProvider.java
View file @
6f5460b
package
org
.
onlab
.
onos
.
provider
.
of
.
device
.
impl
;
import
static
org
.
slf4j
.
LoggerFactory
.
getLogger
;
import
java.net.URI
;
import
java.net.URISyntaxException
;
import
org.apache.felix.scr.annotations.Activate
;
import
org.apache.felix.scr.annotations.Component
;
import
org.apache.felix.scr.annotations.Deactivate
;
...
...
@@ -17,15 +22,11 @@ import org.onlab.onos.net.provider.AbstractProvider;
import
org.onlab.onos.net.provider.ProviderId
;
import
org.onlab.onos.of.controller.Dpid
;
import
org.onlab.onos.of.controller.OpenFlowController
;
import
org.onlab.onos.of.controller.OpenFlowSwitch
;
import
org.onlab.onos.of.controller.OpenFlowSwitchListener
;
import
org.onlab.onos.of.controller.RoleState
;
import
org.slf4j.Logger
;
import
java.net.URI
;
import
java.net.URISyntaxException
;
import
static
org
.
slf4j
.
LoggerFactory
.
getLogger
;
/**
* Provider which uses an OpenFlow controller to detect network
* infrastructure devices.
...
...
@@ -93,16 +94,26 @@ public class OpenFlowDeviceProvider extends AbstractProvider implements DevicePr
private
class
InternalDeviceProvider
implements
OpenFlowSwitchListener
{
@Override
public
void
switchAdded
(
Dpid
dpid
)
{
if
(
providerService
==
null
)
{
return
;
}
URI
uri
=
buildURI
(
dpid
);
// TODO: fetch and provide switch desc information
OpenFlowSwitch
sw
=
controller
.
getSwitch
(
dpid
);
DeviceDescription
description
=
new
DefaultDeviceDescription
(
buildURI
(
dpid
),
Device
.
Type
.
SWITCH
,
null
,
null
,
null
,
null
);
sw
.
manfacturerDescription
(),
sw
.
hardwareDescription
(),
sw
.
softwareDescription
(),
sw
.
softwareDescription
());
providerService
.
deviceConnected
(
new
DeviceId
(
uri
),
description
);
}
@Override
public
void
switchRemoved
(
Dpid
dpid
)
{
if
(
providerService
==
null
)
{
return
;
}
URI
uri
=
buildURI
(
dpid
);
providerService
.
deviceDisconnected
(
new
DeviceId
(
uri
));
}
...
...
Please
register
or
login
to post a comment