Search in sources :

Example 1 with DefaultDhcpRelayConfig

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();
}
Also used : DhcpServerConfig(org.onosproject.dhcprelay.config.DhcpServerConfig) Ip4Address(org.onlab.packet.Ip4Address) DefaultDhcpRelayConfig(org.onosproject.dhcprelay.config.DefaultDhcpRelayConfig)

Example 2 with DefaultDhcpRelayConfig

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);
    }
}
Also used : IgnoreDhcpConfig(org.onosproject.dhcprelay.config.IgnoreDhcpConfig) HostAutoRelearnConfig(org.onosproject.dhcprelay.config.HostAutoRelearnConfig) DefaultDhcpRelayConfig(org.onosproject.dhcprelay.config.DefaultDhcpRelayConfig) IndirectDhcpRelayConfig(org.onosproject.dhcprelay.config.IndirectDhcpRelayConfig)

Example 3 with DefaultDhcpRelayConfig

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);
    }
}
Also used : IgnoreDhcpConfig(org.onosproject.dhcprelay.config.IgnoreDhcpConfig) HostAutoRelearnConfig(org.onosproject.dhcprelay.config.HostAutoRelearnConfig) DefaultDhcpRelayConfig(org.onosproject.dhcprelay.config.DefaultDhcpRelayConfig) IndirectDhcpRelayConfig(org.onosproject.dhcprelay.config.IndirectDhcpRelayConfig)

Aggregations

DefaultDhcpRelayConfig (org.onosproject.dhcprelay.config.DefaultDhcpRelayConfig)3 HostAutoRelearnConfig (org.onosproject.dhcprelay.config.HostAutoRelearnConfig)2 IgnoreDhcpConfig (org.onosproject.dhcprelay.config.IgnoreDhcpConfig)2 IndirectDhcpRelayConfig (org.onosproject.dhcprelay.config.IndirectDhcpRelayConfig)2 Ip4Address (org.onlab.packet.Ip4Address)1 DhcpServerConfig (org.onosproject.dhcprelay.config.DhcpServerConfig)1