Exemplo n.º 1
0
shared_ptr<Vlan> ThriftConfigApplier::updateVlan(const shared_ptr<Vlan>& orig,
        const cfg::Vlan* config) {
    CHECK_EQ(orig->getID(), config->id);
    const auto& ports = vlanPorts_[orig->getID()];

    auto newVlan = orig->clone();
    bool changed_neighbor_table =
        updateNeighborResponseTables(newVlan.get(), config);
    bool changed_dhcp_overrides = updateDhcpOverrides(newVlan.get(), config);
    auto oldDhcpV4Relay = orig->getDhcpV4Relay();
    auto newDhcpV4Relay = config->__isset.dhcpRelayAddressV4 ?
                          IPAddressV4(config->dhcpRelayAddressV4) : IPAddressV4();

    auto oldDhcpV6Relay = orig->getDhcpV6Relay();
    auto newDhcpV6Relay = config->__isset.dhcpRelayAddressV6 ?
                          IPAddressV6(config->dhcpRelayAddressV6) : IPAddressV6("::");


    if (orig->getName() == config->name &&
            orig->getPorts() == ports &&
            oldDhcpV4Relay == newDhcpV4Relay &&
            oldDhcpV6Relay == newDhcpV6Relay &&
            !changed_neighbor_table && !changed_dhcp_overrides) {
        return nullptr;
    }

    newVlan->setName(config->name);
    newVlan->setPorts(ports);
    newVlan->setDhcpV4Relay(newDhcpV4Relay);
    newVlan->setDhcpV6Relay(newDhcpV6Relay);
    return newVlan;
}
	void setupPorts() { setPorts(true); }
Exemplo n.º 3
0
void Fenfloss::param(const char *portname, bool inMapLoading)
{
        int connMeth;
        (void) inMapLoading;
        dprintf(1, "Fenfloss::param(): Entering Fenfloss::param(): %s\n", portname);
        // if spotpoint is changed, we have to copy the values in
	// the "transfer buffers"
        if (!strcmp(portname, p_ConnectionMethod->getName()))
        {
           dprintf(2, "p_ConnectionMethod changed ...\n");
           connMeth = p_ConnectionMethod->getValue();
           if (!strcmp(s_ConnectionMethod[connMeth], "local"))
           {
              p_User->disable();
              p_Hostname->disable();
           }
           else
           {
              p_User->enable();
              p_Hostname->enable();
           }
        }
        else if (!strcmp(portname, p_Port->getName())) {
           
           int min, max;
           int n = sscanf(p_Port->getValue(), "%d %d", &min, &max);
           
           if (!n)
              return;

           if (n == 1)
              setPorts(min, min);
           else
              setPorts(min, max);           
        }

#ifdef HAVE_GLOBUS
	else if (!strcmp(portname, p_Discovery->getName()) || 
                 !strcmp(portname, p_User->getName()))
        {
           // globus support will come back later
        }

	else if (!strcmp(portname, p_Simulations->getName())) {
           int index = p_Simulations->getValue();
           if (index < 1) return;

           char user[128];
           char host[128];
           char port[128];
           char *sim = s_Simulations[index];

           if (sim) {
              if (sscanf(sim, "%s @ %s : %s\n", user, host, port) == 3) {

                 p_User->setValue(user);
                 p_Hostname->setValue(host);
                 p_Port->setValue(port);
              }
              p_ConnectionMethod->setValue(6); // reattach
           }
        }
#endif
}
Exemplo n.º 4
0
void portsStateSet(unsigned int ports_state){
	setPorts(ports_state);
}