<commit_before>""" Main class from dcclient. Manages XML interaction, as well as switch and
creates the actual networks
"""

import rpc
from xml_manager.manager import ManagedXml


from oslo.config import cfg


class Manager:
    def __init__(self):
         self.rpc = rpc.RPC(cfg.CONF.ml2_datacom.dm_username,
                         cfg.CONF.ml2_datacom.dm_password,
                         cfg.CONF.ml2_datacom.dm_host,
                         cfg.CONF.ml2_datacom.dm_method)

         self.xml = ManagedXml()

    def _update(self):
        self.rpc.send_xml(self.xml.xml.as_xml_text())

    def create_network(self, vlan):
        """ Creates a new network on the switch, if it does not exist already.
        """
        self.xml.addVlan(vlan)
        self._update()<commit_msg>Add error treatment for existing network<commit_after>""" Main class from dcclient. Manages XML interaction, as well as switch and
creates the actual networks
"""

import rpc
from xml_manager.manager import ManagedXml


from neutron.openstack.common import log as logger
from oslo.config import cfg


LOG = logger.getLogger(__name__)

class Manager:
    def __init__(self):
         self.rpc = rpc.RPC(cfg.CONF.ml2_datacom.dm_username,
                         cfg.CONF.ml2_datacom.dm_password,
                         cfg.CONF.ml2_datacom.dm_host,
                         cfg.CONF.ml2_datacom.dm_method)

         self.xml = ManagedXml()

    def _update(self):
        self.rpc.send_xml(self.xml.xml.as_xml_text())

    def create_network(self, vlan):
        """ Creates a new network on the switch, if it does not exist already.
        """
        try:
            self.xml.addVlan(vlan)
            self._update()
        except:
            LOG.info("Trying to create already existing network %d:", vlan)
{'fraction_non_alphanumeric': 0.08883953359244864, 'fraction_numerical': 0.004441976679622432, 'mean_word_length': 2.2644927536231885, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 14}, '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': '3907376', 'n_tokens_mistral': 545, 'n_tokens_neox': 535, 'n_words': 140}