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
tom
2014-08-27 16:34:15 -0700
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
db0d03fe512fc6c39fe5deda4f5ec4a117a4028c
db0d03fe
1 parent
edf06bb5
Added more trivial core implementations.
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
160 additions
and
6 deletions
net/api/src/main/java/org/onlab/onos/net/host/HostProvider.java
net/api/src/main/java/org/onlab/onos/net/host/HostProviderService.java
net/api/src/main/java/org/onlab/onos/net/link/LinkProviderService.java
net/core/trivial/src/main/java/org/onlab/onos/net/trivial/impl/SimpleHostManager.java
net/core/trivial/src/main/java/org/onlab/onos/net/trivial/impl/SimpleLinkManager.java
net/api/src/main/java/org/onlab/onos/net/host/HostProvider.java
View file @
db0d03f
...
...
@@ -14,7 +14,7 @@ public interface HostProvider extends Provider {
* Triggers an asynchronous probe of the specified host, intended to
* determine whether the host is present or not. An indirect result of this
* should be invocation of {@link org.onlab.onos.net.host.HostProviderService#hostDetected(HostDescription)} or
* {@link org.onlab.onos.net.host.HostProviderService#host
NotDetect
ed(HostDescription)}
* {@link org.onlab.onos.net.host.HostProviderService#host
Vanish
ed(HostDescription)}
* at some later point in time.
*
* @param host host to probe
...
...
net/api/src/main/java/org/onlab/onos/net/host/HostProviderService.java
View file @
db0d03f
...
...
@@ -20,6 +20,6 @@ public interface HostProviderService extends ProviderService<HostProvider> {
*
* @param hostDescription description of host
*/
void
host
NotDetect
ed
(
HostDescription
hostDescription
);
void
host
Vanish
ed
(
HostDescription
hostDescription
);
}
...
...
net/api/src/main/java/org/onlab/onos/net/link/LinkProviderService.java
View file @
db0d03f
...
...
@@ -8,17 +8,17 @@ import org.onlab.onos.net.provider.ProviderService;
public
interface
LinkProviderService
extends
ProviderService
<
LinkProvider
>
{
/**
* Signals that an infrastructure link has been
conn
ected.
* Signals that an infrastructure link has been
det
ected.
*
* @param linkDescription link information
*/
void
link
Conn
ected
(
LinkDescription
linkDescription
);
void
link
Det
ected
(
LinkDescription
linkDescription
);
/**
* Signals that an infrastructure link has
been disconnect
ed.
* Signals that an infrastructure link has
disappear
ed.
*
* @param linkDescription link information
*/
void
link
Disconnect
ed
(
LinkDescription
linkDescription
);
void
link
Vanish
ed
(
LinkDescription
linkDescription
);
}
...
...
net/core/trivial/src/main/java/org/onlab/onos/net/trivial/impl/SimpleHostManager.java
0 → 100644
View file @
db0d03f
package
org
.
onlab
.
onos
.
net
.
trivial
.
impl
;
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.onlab.onos.net.host.HostDescription
;
import
org.onlab.onos.net.host.HostProvider
;
import
org.onlab.onos.net.host.HostProviderBroker
;
import
org.onlab.onos.net.host.HostProviderService
;
import
org.onlab.onos.net.provider.AbstractProviderBroker
;
import
org.onlab.onos.net.provider.AbstractProviderService
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
/**
* Provides basic implementation of the host SB & NB APIs.
*/
@Component
(
immediate
=
true
)
@Service
public
class
SimpleHostManager
implements
HostProviderBroker
{
private
Logger
log
=
LoggerFactory
.
getLogger
(
SimpleHostManager
.
class
);
private
final
HostProviderBroker
broker
=
new
InternalBroker
();
@Activate
public
void
activate
()
{
log
.
info
(
"Started"
);
}
@Deactivate
public
void
deactivate
()
{
log
.
info
(
"Stopped"
);
}
@Override
public
HostProviderService
register
(
HostProvider
provider
)
{
log
.
info
(
"Registering provider {}"
,
provider
.
id
());
return
broker
.
register
(
provider
);
}
@Override
public
void
unregister
(
HostProvider
provider
)
{
log
.
info
(
"Unregistering provider {}"
,
provider
.
id
());
broker
.
unregister
(
provider
);
}
// Internal delegate for tracking various providers and issuing them a
// personalized provider service.
private
class
InternalBroker
extends
AbstractProviderBroker
<
HostProvider
,
HostProviderService
>
implements
HostProviderBroker
{
@Override
protected
HostProviderService
createProviderService
(
HostProvider
provider
)
{
return
new
InternalHostProviderService
(
provider
);
}
}
// Personalized host provider service issued to the supplied provider.
private
class
InternalHostProviderService
extends
AbstractProviderService
<
HostProvider
>
implements
HostProviderService
{
public
InternalHostProviderService
(
HostProvider
provider
)
{
super
(
provider
);
}
@Override
public
void
hostDetected
(
HostDescription
hostDescription
)
{
log
.
info
(
"Host {} detected"
,
hostDescription
);
}
@Override
public
void
hostVanished
(
HostDescription
hostDescription
)
{
log
.
info
(
"Host {} vanished"
,
hostDescription
);
}
}
}
net/core/trivial/src/main/java/org/onlab/onos/net/trivial/impl/SimpleLinkManager.java
0 → 100644
View file @
db0d03f
package
org
.
onlab
.
onos
.
net
.
trivial
.
impl
;
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.onlab.onos.net.link.LinkDescription
;
import
org.onlab.onos.net.link.LinkProvider
;
import
org.onlab.onos.net.link.LinkProviderBroker
;
import
org.onlab.onos.net.link.LinkProviderService
;
import
org.onlab.onos.net.provider.AbstractProviderBroker
;
import
org.onlab.onos.net.provider.AbstractProviderService
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
/**
* Provides basic implementation of the link SB & NB APIs.
*/
@Component
(
immediate
=
true
)
@Service
public
class
SimpleLinkManager
implements
LinkProviderBroker
{
private
Logger
log
=
LoggerFactory
.
getLogger
(
SimpleLinkManager
.
class
);
private
final
LinkProviderBroker
broker
=
new
InternalBroker
();
@Activate
public
void
activate
()
{
log
.
info
(
"Started"
);
}
@Deactivate
public
void
deactivate
()
{
log
.
info
(
"Stopped"
);
}
@Override
public
LinkProviderService
register
(
LinkProvider
provider
)
{
log
.
info
(
"Registering provider {}"
,
provider
.
id
());
return
broker
.
register
(
provider
);
}
@Override
public
void
unregister
(
LinkProvider
provider
)
{
log
.
info
(
"Unregistering provider {}"
,
provider
.
id
());
broker
.
unregister
(
provider
);
}
// Internal delegate for tracking various providers and issuing them a
// personalized provider service.
private
class
InternalBroker
extends
AbstractProviderBroker
<
LinkProvider
,
LinkProviderService
>
implements
LinkProviderBroker
{
@Override
protected
LinkProviderService
createProviderService
(
LinkProvider
provider
)
{
return
new
InternalLinkProviderService
(
provider
);
}
}
// Personalized link provider service issued to the supplied provider.
private
class
InternalLinkProviderService
extends
AbstractProviderService
<
LinkProvider
>
implements
LinkProviderService
{
public
InternalLinkProviderService
(
LinkProvider
provider
)
{
super
(
provider
);
}
@Override
public
void
linkDetected
(
LinkDescription
linkDescription
)
{
log
.
info
(
"Link {} detected"
,
linkDescription
);
}
@Override
public
void
linkVanished
(
LinkDescription
linkDescription
)
{
log
.
info
(
"Link {} vanished"
,
linkDescription
);
}
}
}
Please
register
or
login
to post a comment