<commit_before>/*
 * Copyright (c) 2016 Ericsson India Global Services Pvt Ltd. and others.  All rights reserved.
 *
 * This program and the accompanying materials are made available under the
 * terms of the Eclipse Public License v1.0 which accompanies this distribution,
 * and is available at http://www.eclipse.org/legal/epl-v10.html
 */
package org.opendaylight.netvirt.elan.internal;

import java.math.BigInteger;
import java.util.Collections;

import org.opendaylight.controller.md.sal.binding.api.DataBroker;
import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType;
import org.opendaylight.genius.datastoreutils.AsyncDataTreeChangeListenerBase;
import org.opendaylight.genius.datastoreutils.DataStoreJobCoordinator;
import org.opendaylight.netvirt.elan.ElanException;
import org.opendaylight.netvirt.elan.utils.ElanConstants;
import org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.op.rev160406.TepTypeInternal;
import org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.op.rev160406.TunnelOperStatus;
import org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.op.rev160406.TunnelsState;
import org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.op.rev160406.tunnels_state.StateTunnelList;
import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

public class ElanTunnelInterfaceStateListener extends AsyncDataTreeChangeListenerBase<StateTunnelList,
    ElanTunnelInterfaceStateListener> implements AutoCloseable {
    private static final Logger LOG = LoggerFactory.getLogger(ElanTunnelInterfaceStateListener.class);
    private final DataBroker dataBroker;
    private final ElanInterfaceManager elanInterfaceManager;

    public ElanTunnelInterfaceStateListener(final DataBroker dataBroker,
            final ElanInterfaceManager elanInterfaceManager) {
        super(StateTunnelList.class, ElanTunnelInterfaceStateListener.class);
        this.dataBroker = dataBroker;
        this.elanInterfaceManager = elanInterfaceManager;
    }

    @Override
    public void init() {
        registerListener(LogicalDatastoreType.OPERATIONAL, dataBroker);
    }

    @Override
    protected InstanceIdentifier<StateTunnelList> getWildCardPath() {
        return InstanceIdentifier.create(TunnelsState.class).child(StateTunnelList.class);
    }

    @Override
    protected void remove(InstanceIdentifier<StateTunnelList> key, StateTunnelList delete) {
    }

    @Override
    protected void update(InstanceIdentifier<StateTunnelList> key, StateTunnelList original,
            StateTunnelList update) {
    }

    @Override
    protected void add(InstanceIdentifier<StateTunnelList> key, StateTunnelList add) {
        LOG.info("processing add state for StateTunnelList {}", add);
        if (!isInternalTunnel(add)) {
            LOG.trace("tunnel {} is not a internal vxlan tunnel", add);
        }<commit_msg>Bug 8023: returning if StateTunnelList is not internal<commit_after>/*
 * Copyright (c) 2016 Ericsson India Global Services Pvt Ltd. and others.  All rights reserved.
 *
 * This program and the accompanying materials are made available under the
 * terms of the Eclipse Public License v1.0 which accompanies this distribution,
 * and is available at http://www.eclipse.org/legal/epl-v10.html
 */
package org.opendaylight.netvirt.elan.internal;

import java.math.BigInteger;
import java.util.Collections;

import org.opendaylight.controller.md.sal.binding.api.DataBroker;
import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType;
import org.opendaylight.genius.datastoreutils.AsyncDataTreeChangeListenerBase;
import org.opendaylight.genius.datastoreutils.DataStoreJobCoordinator;
import org.opendaylight.netvirt.elan.ElanException;
import org.opendaylight.netvirt.elan.utils.ElanConstants;
import org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.op.rev160406.TepTypeInternal;
import org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.op.rev160406.TunnelOperStatus;
import org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.op.rev160406.TunnelsState;
import org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.op.rev160406.tunnels_state.StateTunnelList;
import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

public class ElanTunnelInterfaceStateListener extends AsyncDataTreeChangeListenerBase<StateTunnelList,
    ElanTunnelInterfaceStateListener> implements AutoCloseable {
    private static final Logger LOG = LoggerFactory.getLogger(ElanTunnelInterfaceStateListener.class);
    private final DataBroker dataBroker;
    private final ElanInterfaceManager elanInterfaceManager;

    public ElanTunnelInterfaceStateListener(final DataBroker dataBroker,
            final ElanInterfaceManager elanInterfaceManager) {
        super(StateTunnelList.class, ElanTunnelInterfaceStateListener.class);
        this.dataBroker = dataBroker;
        this.elanInterfaceManager = elanInterfaceManager;
    }

    @Override
    public void init() {
        registerListener(LogicalDatastoreType.OPERATIONAL, dataBroker);
    }

    @Override
    protected InstanceIdentifier<StateTunnelList> getWildCardPath() {
        return InstanceIdentifier.create(TunnelsState.class).child(StateTunnelList.class);
    }

    @Override
    protected void remove(InstanceIdentifier<StateTunnelList> key, StateTunnelList delete) {
    }

    @Override
    protected void update(InstanceIdentifier<StateTunnelList> key, StateTunnelList original,
            StateTunnelList update) {
    }

    @Override
    protected void add(InstanceIdentifier<StateTunnelList> key, StateTunnelList add) {
        LOG.info("processing add state for StateTunnelList {}", add);
        if (!isInternalTunnel(add)) {
            LOG.trace("tunnel {} is not a internal vxlan tunnel", add);
            return;
        }
{'fraction_non_alphanumeric': 0.0820807296064854, 'fraction_numerical': 0.013511231210944098, 'mean_word_length': 4.788856304985337, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 13, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2899536', 'n_tokens_mistral': 1833, 'n_tokens_neox': 1759, 'n_words': 328}