Search in sources :

Example 1 with Config

use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.mdsaltrace.rev160908.Config in project jdk8u_jdk by JetBrains.

the class Semicolon method main.

public static void main(String[] args) throws Throwable {
    System.setProperty("java.security.krb5.conf", System.getProperty("test.src", ".") + "/comments.conf");
    Config config = Config.getInstance();
    config.get("section", "value");
}
Also used : Config(sun.security.krb5.Config)

Example 2 with Config

use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.mdsaltrace.rev160908.Config in project jdk8u_jdk by JetBrains.

the class ConfigWithQuotations method main.

public static void main(String[] args) throws Exception {
    // This config file is generated using Kerberos.app on a Mac
    System.setProperty("java.security.krb5.conf", System.getProperty("test.src", ".") + "/edu.mit.Kerberos");
    Config config = Config.getInstance();
    System.out.println(config);
    if (!config.getDefaultRealm().equals("MAC.LOCAL")) {
        throw new Exception("Realm error");
    }
    if (!config.getKDCList("MAC.LOCAL").equals("kdc.mac.local:88")) {
        throw new Exception("KDC error");
    }
}
Also used : Config(sun.security.krb5.Config)

Example 3 with Config

use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.mdsaltrace.rev160908.Config in project jdk8u_jdk by JetBrains.

the class KDCOptions method setDefault.

private void setDefault() {
    try {
        Config config = Config.getInstance();
        // If key not present, returns Integer.MIN_VALUE, which is
        // almost all zero.
        int options = config.getIntValue("libdefaults", "kdc_default_options");
        if ((options & KDC_OPT_RENEWABLE_OK) == KDC_OPT_RENEWABLE_OK) {
            set(RENEWABLE_OK, true);
        } else {
            if (config.getBooleanValue("libdefaults", "renewable")) {
                set(RENEWABLE_OK, true);
            }
        }
        if ((options & KDC_OPT_PROXIABLE) == KDC_OPT_PROXIABLE) {
            set(PROXIABLE, true);
        } else {
            if (config.getBooleanValue("libdefaults", "proxiable")) {
                set(PROXIABLE, true);
            }
        }
        if ((options & KDC_OPT_FORWARDABLE) == KDC_OPT_FORWARDABLE) {
            set(FORWARDABLE, true);
        } else {
            if (config.getBooleanValue("libdefaults", "forwardable")) {
                set(FORWARDABLE, true);
            }
        }
    } catch (KrbException e) {
        if (DEBUG) {
            System.out.println("Exception in getting default values for " + "KDC Options from the configuration ");
            e.printStackTrace();
        }
    }
}
Also used : Config(sun.security.krb5.Config) KrbException(sun.security.krb5.KrbException)

Example 4 with Config

use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.mdsaltrace.rev160908.Config in project Payara by payara.

the class WebContainerImpl method setConfiguration.

// --------------------------------------------------------- Public Methods
public void setConfiguration(WebContainerConfig config) {
    if (!initialized) {
        init();
    }
    this.config = config;
    final WebContainerConfig webConfig = config;
    try {
        VirtualServer vs = getVirtualServer(config.getVirtualServerId());
        if (vs != null) {
            ((StandardHost) vs).setDefaultWebXmlLocation(config.getDefaultWebXml().getPath());
        }
        com.sun.enterprise.config.serverbeans.VirtualServer vsBean = httpService.getVirtualServerByName(config.getVirtualServerId());
        if (vsBean != null) {
            ConfigSupport.apply(new SingleConfigCode<com.sun.enterprise.config.serverbeans.VirtualServer>() {

                public Object run(com.sun.enterprise.config.serverbeans.VirtualServer avs) throws PropertyVetoException, TransactionFailure {
                    avs.setId(webConfig.getVirtualServerId());
                    if (webConfig.getDocRootDir() != null) {
                        avs.setDocroot(webConfig.getDocRootDir().getAbsolutePath());
                    }
                    avs.setHosts(webConfig.getHostNames());
                    avs.setNetworkListeners(webConfig.getListenerName());
                    Property property = avs.createChild(Property.class);
                    property.setName("default-web-xml");
                    property.setValue(webConfig.getDefaultWebXml().getPath());
                    avs.getProperty().add(property);
                    return avs;
                }
            }, vsBean);
        } else {
            vs = createVirtualServer(config.getVirtualServerId(), config.getDocRootDir());
            addVirtualServer(vs);
        }
        EmbeddedWebArchivist archivist = habitat.<EmbeddedWebArchivist>getService(EmbeddedWebArchivist.class);
        archivist.setDefaultWebXml(config.getDefaultWebXml());
        embedded.setDirectoryListing(config.getListings());
        WebListener listener = getWebListener(config.getListenerName());
        if (listener == null) {
            listener = getWebListener(config.getPort());
            if (listener == null) {
                boolean found = false;
                for (Map.Entry entry : webContainer.getConnectorMap().entrySet()) {
                    if (((WebConnector) entry.getValue()).getPort() == config.getPort()) {
                        found = true;
                        log.info("Port " + config.getPort() + " is already configured");
                    }
                }
                if (!found) {
                    listener = createWebListener(config.getListenerName(), HttpListener.class);
                    listener.setPort(config.getPort());
                    addWebListener(listener, config.getVirtualServerId());
                }
            }
        } else {
            if (listener.getPort() != config.getPort()) {
                listener.setPort(config.getPort());
            }
        }
    } catch (Exception ex) {
        ex.printStackTrace();
    }
}
Also used : WebContainerConfig(org.glassfish.embeddable.web.config.WebContainerConfig) VirtualServer(org.glassfish.embeddable.web.VirtualServer) PropertyVetoException(java.beans.PropertyVetoException) ConfigException(org.glassfish.embeddable.web.ConfigException) GlassFishException(org.glassfish.embeddable.GlassFishException) PropertyVetoException(java.beans.PropertyVetoException) WebListener(org.glassfish.embeddable.web.WebListener) StandardHost(org.apache.catalina.core.StandardHost) HttpListener(org.glassfish.embeddable.web.HttpListener) org.jvnet.hk2.config(org.jvnet.hk2.config) Property(org.jvnet.hk2.config.types.Property)

Example 5 with Config

use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.mdsaltrace.rev160908.Config in project netvirt by opendaylight.

the class ElanPacketInHandler method onPacketReceived.

@Override
public void onPacketReceived(PacketReceived notification) {
    Class<? extends PacketInReason> pktInReason = notification.getPacketInReason();
    short tableId = notification.getTableId().getValue();
    if (pktInReason == NoMatch.class && tableId == NwConstants.ELAN_SMAC_TABLE) {
        ElanManagerCounters.unknown_smac_pktin_rcv.inc();
        try {
            byte[] data = notification.getPayload();
            Ethernet res = new Ethernet();
            res.deserialize(data, 0, data.length * NetUtils.NUM_BITS_IN_A_BYTE);
            byte[] srcMac = res.getSourceMACAddress();
            final String macAddress = NWUtil.toStringMacAddress(srcMac);
            final BigInteger metadata = notification.getMatch().getMetadata().getMetadata();
            final long elanTag = MetaDataUtil.getElanTagFromMetadata(metadata);
            long portTag = MetaDataUtil.getLportFromMetadata(metadata).intValue();
            Optional<IfIndexInterface> interfaceInfoOp = elanUtils.getInterfaceInfoByInterfaceTag(portTag);
            if (!interfaceInfoOp.isPresent()) {
                LOG.warn("There is no interface for given portTag {}", portTag);
                return;
            }
            String interfaceName = interfaceInfoOp.get().getInterfaceName();
            LOG.debug("Received a packet with srcMac: {} ElanTag: {} PortTag: {} InterfaceName: {}", macAddress, elanTag, portTag, interfaceName);
            ElanTagName elanTagName = elanUtils.getElanInfoByElanTag(elanTag);
            if (elanTagName == null) {
                LOG.warn("not able to find elanTagName in elan-tag-name-map for elan tag {}", elanTag);
                return;
            }
            ElanInterfaceMac elanInterfaceMac = elanUtils.getElanInterfaceMacByInterfaceName(interfaceName);
            if (elanInterfaceMac == null) {
                LOG.info("There is no ElanInterfaceForwardingEntryDS created for interface :{}", interfaceName);
                return;
            }
            String elanName = elanTagName.getName();
            PhysAddress physAddress = new PhysAddress(macAddress);
            MacEntry oldMacEntry = elanUtils.getMacEntryForElanInstance(elanName, physAddress).orNull();
            boolean isVlanOrFlatProviderIface = interfaceManager.isExternalInterface(interfaceName);
            Optional<IpAddress> srcIpAddress = elanUtils.getSourceIpAddress(res);
            MacEntry newMacEntry = null;
            BigInteger timeStamp = new BigInteger(String.valueOf(System.currentTimeMillis()));
            if (!srcIpAddress.isPresent()) {
                newMacEntry = new MacEntryBuilder().setInterface(interfaceName).setMacAddress(physAddress).setKey(new MacEntryKey(physAddress)).setControllerLearnedForwardingEntryTimestamp(timeStamp).setIsStaticAddress(false).build();
            } else {
                newMacEntry = new MacEntryBuilder().setInterface(interfaceName).setMacAddress(physAddress).setIpPrefix(srcIpAddress.get()).setKey(new MacEntryKey(physAddress)).setControllerLearnedForwardingEntryTimestamp(timeStamp).setIsStaticAddress(false).build();
            }
            if (srcIpAddress.isPresent()) {
                String prefix = srcIpAddress.get().getIpv4Address().getValue();
                InterfaceInfo interfaceInfo = interfaceManager.getInterfaceInfo(interfaceName);
                ElanInstance elanInstance = elanInstanceCache.get(elanName).orNull();
                evpnUtils.advertisePrefix(elanInstance, macAddress, prefix, interfaceName, interfaceInfo.getDpId());
            }
            enqueueJobForMacSpecificTasks(macAddress, elanTag, interfaceName, elanName, physAddress, oldMacEntry, newMacEntry, isVlanOrFlatProviderIface);
            ElanInstance elanInstance = elanInstanceCache.get(elanName).orNull();
            InterfaceInfo interfaceInfo = interfaceManager.getInterfaceInfo(interfaceName);
            if (interfaceInfo == null) {
                LOG.trace("Interface:{} is not present under Config DS", interfaceName);
                return;
            }
            enqueueJobForDPNSpecificTasks(macAddress, elanTag, interfaceName, physAddress, elanInstance, interfaceInfo, oldMacEntry, newMacEntry, isVlanOrFlatProviderIface);
        } catch (PacketException e) {
            LOG.error("Failed to decode packet: {}", notification, e);
        }
    }
}
Also used : ElanTagName(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.rev150602.elan.tag.name.map.ElanTagName) ElanInstance(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.rev150602.elan.instances.ElanInstance) MacEntry(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.rev150602.forwarding.entries.MacEntry) IfIndexInterface(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.meta.rev160406._if.indexes._interface.map.IfIndexInterface) PacketException(org.opendaylight.openflowplugin.libraries.liblldp.PacketException) Ethernet(org.opendaylight.genius.mdsalutil.packet.Ethernet) BigInteger(java.math.BigInteger) IpAddress(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpAddress) InterfaceInfo(org.opendaylight.genius.interfacemanager.globals.InterfaceInfo) MacEntryBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.rev150602.forwarding.entries.MacEntryBuilder) NoMatch(org.opendaylight.yang.gen.v1.urn.opendaylight.packet.service.rev130709.NoMatch) ElanInterfaceMac(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.rev150602.elan._interface.forwarding.entries.ElanInterfaceMac) PhysAddress(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.PhysAddress) MacEntryKey(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.rev150602.forwarding.entries.MacEntryKey)

Aggregations

ArrayList (java.util.ArrayList)47 Test (org.junit.Test)46 BigInteger (java.math.BigInteger)29 ReadFailedException (org.opendaylight.controller.md.sal.common.api.data.ReadFailedException)23 IpAddress (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpAddress)23 ByteBuf (io.netty.buffer.ByteBuf)21 MacAddress (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.MacAddress)21 TransactionCommitFailedException (org.opendaylight.controller.md.sal.common.api.data.TransactionCommitFailedException)20 Interface (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.Interface)19 Uuid (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.Uuid)19 Node (org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.Node)19 ListenableFuture (com.google.common.util.concurrent.ListenableFuture)16 ExecutionException (java.util.concurrent.ExecutionException)16 Optional (com.google.common.base.Optional)15 List (java.util.List)15 WriteTransaction (org.opendaylight.controller.md.sal.binding.api.WriteTransaction)14 TransportZone (org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.rev160406.transport.zones.TransportZone)14 InstanceIdentifier (org.opendaylight.yangtools.yang.binding.InstanceIdentifier)14 InterfaceKey (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.InterfaceKey)12 Vteps (org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.rev160406.transport.zones.transport.zone.subnets.Vteps)12