<commit_before>#!/usr/bin/python
#
# Copyright (c) 2013 Juniper Networks, Inc. All rights reserved.
#

import os
import sys
import argparse
import ConfigParser
from fabric.api import local, run
from fabric.state import env
from fabric.context_managers import settings, lcd

from contrail_provisioning.common.base import ContrailSetup
from contrail_provisioning.compute.toragent.templates import tor_agent_conf
from contrail_provisioning.compute.toragent.templates import tor_agent_ini

class TorAgentBaseSetup(ContrailSetup):
    def __init__(self, tor_agent_args, args_str=None):
        super(TorAgentBaseSetup, self).__init__()
        self._args = tor_agent_args


    def fixup_tor_agent(self):
        template_vals = {'__contrail_agent_name__':self._args.agent_name,
                         '__contrail_http_server_port__':self._args.http_server_port,
                         '__contrail_discovery_ip__':self._args.discovery_server_ip,
                         '__contrail_tor_ip__':self._args.tor_ip,
                         '__contrail_tor_id__':self._args.tor_id,
                         '__contrail_tsn_ovs_port__':self._args.tor_ovs_port,
                         '__contrail_tsn_ip__':self._args.tsn_ip,
                         '__contrail_tor_ovs_protocol__':self._args.tor_ovs_protocol, 
                         '__contrail_control_ip__':self._args.self_ip
                        }
        self._template_substitute_write(tor_agent_conf.template,
                                        template_vals, self._temp_dir_name + '/tor_agent_conf')
        self.tor_file_name='contrail-tor-agent-' + self._args.tor_id + '.conf'
        local("sudo mv %s/tor_agent_conf /etc/contrail/%s" %(self._temp_dir_name,self.tor_file_name))

    def fixup_tor_ini(self):<commit_msg>Adding missing commit related to tor proviosning.<commit_after>#!/usr/bin/python
#
# Copyright (c) 2013 Juniper Networks, Inc. All rights reserved.
#

import os
import sys
import argparse
import ConfigParser
from fabric.api import local, run
from fabric.state import env
from fabric.context_managers import settings, lcd

from contrail_provisioning.common.base import ContrailSetup
from contrail_provisioning.compute.toragent.templates import tor_agent_conf
from contrail_provisioning.compute.toragent.templates import tor_agent_ini

class TorAgentBaseSetup(ContrailSetup):
    def __init__(self, tor_agent_args, args_str=None):
        super(TorAgentBaseSetup, self).__init__()
        self._args = tor_agent_args


    def fixup_tor_agent(self):
        template_vals = {'__contrail_control_ip__':self._args.self_ip,
                         '__contrail_agent_name__':self._args.agent_name,
                         '__contrail_http_server_port__':self._args.http_server_port,
                         '__contrail_discovery_ip__':self._args.discovery_server_ip,
                         '__contrail_tor_ip__':self._args.tor_ip,
                         '__contrail_tor_id__':self._args.tor_id,
                         '__contrail_tsn_ovs_port__':self._args.tor_ovs_port,
                         '__contrail_tsn_ip__':self._args.tsn_ip,
                         '__contrail_tor_ovs_protocol__':self._args.tor_ovs_protocol,
                        }
        self._template_substitute_write(tor_agent_conf.template,
                                        template_vals, self._temp_dir_name + '/tor_agent_conf')
        self.tor_file_name='contrail-tor-agent-' + self._args.tor_id + '.conf'
        local("sudo mv %s/tor_agent_conf /etc/contrail/%s" %(self._temp_dir_name,self.tor_file_name))

    def fixup_tor_ini(self):
{'fraction_non_alphanumeric': 0.08310249307479224, 'fraction_numerical': 0.00221606648199446, 'mean_word_length': 2.797055730809674, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6194321', 'n_tokens_mistral': 1136, 'n_tokens_neox': 1083, 'n_words': 165}