use of org.onosproject.dhcprelay.config.DefaultDhcpRelayConfig in project onos by opennetworkinglab.
the class DhcpRelayManager method getDhcpServerMacAddress.
@Override
public Optional<MacAddress> getDhcpServerMacAddress() {
// TODO: depreated it
DefaultDhcpRelayConfig config = cfgService.getConfig(appId, DefaultDhcpRelayConfig.class);
DhcpServerConfig serverConfig = config.dhcpServerConfigs().get(0);
Ip4Address serverip = serverConfig.getDhcpServerIp4().get();
return hostService.getHostsByIp(serverip).stream().map(Host::mac).findFirst();
}
use of org.onosproject.dhcprelay.config.DefaultDhcpRelayConfig in project onos by opennetworkinglab.
the class DhcpRelayManager method updateConfig.
/**
* Updates DHCP relay app configuration with given configuration.
*
* @param config the configuration ot update
*/
protected void updateConfig(Config config) {
if (config instanceof IndirectDhcpRelayConfig) {
IndirectDhcpRelayConfig indirectConfig = (IndirectDhcpRelayConfig) config;
v4Handler.setIndirectDhcpServerConfigs(indirectConfig.dhcpServerConfigs());
v6Handler.setIndirectDhcpServerConfigs(indirectConfig.dhcpServerConfigs());
} else if (config instanceof DefaultDhcpRelayConfig) {
DefaultDhcpRelayConfig defaultConfig = (DefaultDhcpRelayConfig) config;
v4Handler.setDefaultDhcpServerConfigs(defaultConfig.dhcpServerConfigs());
v6Handler.setDefaultDhcpServerConfigs(defaultConfig.dhcpServerConfigs());
}
if (config instanceof IgnoreDhcpConfig) {
v4Handler.updateIgnoreVlanConfig((IgnoreDhcpConfig) config);
v6Handler.updateIgnoreVlanConfig((IgnoreDhcpConfig) config);
}
if (config instanceof HostAutoRelearnConfig) {
setHostAutoRelearnConfig((HostAutoRelearnConfig) config);
}
}
use of org.onosproject.dhcprelay.config.DefaultDhcpRelayConfig in project onos by opennetworkinglab.
the class DhcpRelayManager method updateConfig.
/**
* Updates DHCP relay app configuration.
*/
private void updateConfig() {
DefaultDhcpRelayConfig defaultConfig = cfgService.getConfig(appId, DefaultDhcpRelayConfig.class);
IndirectDhcpRelayConfig indirectConfig = cfgService.getConfig(appId, IndirectDhcpRelayConfig.class);
IgnoreDhcpConfig ignoreDhcpConfig = cfgService.getConfig(appId, IgnoreDhcpConfig.class);
HostAutoRelearnConfig hostAutoRelearnConfig = cfgService.getConfig(appId, HostAutoRelearnConfig.class);
if (defaultConfig != null) {
updateConfig(defaultConfig);
}
if (indirectConfig != null) {
updateConfig(indirectConfig);
}
if (ignoreDhcpConfig != null) {
updateConfig(ignoreDhcpConfig);
}
if (hostAutoRelearnConfig != null) {
updateConfig(hostAutoRelearnConfig);
}
}
Aggregations