aboutsummaryrefslogtreecommitdiffstats
path: root/fdio.infra.ansible/roles/tg/tasks/main.yaml
diff options
context:
space:
mode:
authorpmikus <pmikus@cisco.com>2021-04-08 10:44:18 +0000
committerPeter Mikus <pmikus@cisco.com>2021-04-08 11:17:15 +0000
commitdf5672b3d9c29b51397f4770eb992c9f3f3955ce (patch)
treeadb4cf36c9b680ebbc44c953391a0d21b986d6b7 /fdio.infra.ansible/roles/tg/tasks/main.yaml
parent8018da98e0f362bc69fc9600fac222a86fd46b5e (diff)
Ansible git move
+ Better accessibility + Compliant with fdio.infra._function_ - function [pxe|terraform|ansible|vagrant] + dill==0.3.3 also applied on TBs - ci-man to follow today - Docs to be updated in separate patch Signed-off-by: pmikus <pmikus@cisco.com> Change-Id: Iff9eaa29d63044188cc8160db2d9b44b7635782a
Diffstat (limited to 'fdio.infra.ansible/roles/tg/tasks/main.yaml')
-rw-r--r--fdio.infra.ansible/roles/tg/tasks/main.yaml30
1 files changed, 30 insertions, 0 deletions
diff --git a/fdio.infra.ansible/roles/tg/tasks/main.yaml b/fdio.infra.ansible/roles/tg/tasks/main.yaml
new file mode 100644
index 0000000000..4e79dabfab
--- /dev/null
+++ b/fdio.infra.ansible/roles/tg/tasks/main.yaml
@@ -0,0 +1,30 @@
+---
+# file: roles/tg/tasks/main.yaml
+
+- name: Conf - csit-initialize-docker-tg.sh
+ copy:
+ src: "files/csit-initialize-docker-tg.sh"
+ dest: "/usr/local/bin/csit-initialize-docker-tg.sh"
+ owner: "root"
+ group: "root"
+ mode: 0744
+ when:
+ - docker_tg is defined
+ tags:
+ - tg-conf-docker
+
+- name: Conf - Start csit-initialize-docker-tg.service
+ copy:
+ src: "files/csit-initialize-docker-tg.service"
+ dest: "/etc/systemd/system/"
+ owner: "root"
+ group: "root"
+ mode: 0644
+ notify:
+ - "Start csit-initialize-docker-tg.service"
+ when:
+ - docker_tg is defined
+ tags:
+ - tg-conf-docker
+
+- meta: flush_handlers
al.String */ .highlight .na { color: #a6e22e } /* Name.Attribute */ .highlight .nb { color: #f8f8f2 } /* Name.Builtin */ .highlight .nc { color: #a6e22e } /* Name.Class */ .highlight .no { color: #66d9ef } /* Name.Constant */ .highlight .nd { color: #a6e22e } /* Name.Decorator */ .highlight .ni { color: #f8f8f2 } /* Name.Entity */ .highlight .ne { color: #a6e22e } /* Name.Exception */ .highlight .nf { color: #a6e22e } /* Name.Function */ .highlight .nl { color: #f8f8f2 } /* Name.Label */ .highlight .nn { color: #f8f8f2 } /* Name.Namespace */ .highlight .nx { color: #a6e22e } /* Name.Other */ .highlight .py { color: #f8f8f2 } /* Name.Property */ .highlight .nt { color: #f92672 } /* Name.Tag */ .highlight .nv { color: #f8f8f2 } /* Name.Variable */ .highlight .ow { color: #f92672 } /* Operator.Word */ .highlight .w { color: #f8f8f2 } /* Text.Whitespace */ .highlight .mb { color: #ae81ff } /* Literal.Number.Bin */ .highlight .mf { color: #ae81ff } /* Literal.Number.Float */ .highlight .mh { color: #ae81ff } /* Literal.Number.Hex */ .highlight .mi { color: #ae81ff } /* Literal.Number.Integer */ .highlight .mo { color: #ae81ff } /* Literal.Number.Oct */ .highlight .sa { color: #e6db74 } /* Literal.String.Affix */ .highlight .sb { color: #e6db74 } /* Literal.String.Backtick */ .highlight .sc { color: #e6db74 } /* Literal.String.Char */ .highlight .dl { color: #e6db74 } /* Literal.String.Delimiter */ .highlight .sd { color: #e6db74 } /* Literal.String.Doc */ .highlight .s2 { color: #e6db74 } /* Literal.String.Double */ .highlight .se { color: #ae81ff } /* Literal.String.Escape */ .highlight .sh { color: #e6db74 } /* Literal.String.Heredoc */ .highlight .si { color: #e6db74 } /* Literal.String.Interpol */ .highlight .sx { color: #e6db74 } /* Literal.String.Other */ .highlight .sr { color: #e6db74 } /* Literal.String.Regex */ .highlight .s1 { color: #e6db74 } /* Literal.String.Single */ .highlight .ss { color: #e6db74 } /* Literal.String.Symbol */ .highlight .bp { color: #f8f8f2 } /* Name.Builtin.Pseudo */ .highlight .fm { color: #a6e22e } /* Name.Function.Magic */ .highlight .vc { color: #f8f8f2 } /* Name.Variable.Class */ .highlight .vg { color: #f8f8f2 } /* Name.Variable.Global */ .highlight .vi { color: #f8f8f2 } /* Name.Variable.Instance */ .highlight .vm { color: #f8f8f2 } /* Name.Variable.Magic */ .highlight .il { color: #ae81ff } /* Literal.Number.Integer.Long */ } @media (prefers-color-scheme: light) { .highlight .hll { background-color: #ffffcc } .highlight .c { color: #888888 } /* Comment */ .highlight .err { color: #a61717; background-color: #e3d2d2 } /* Error */ .highlight .k { color: #008800; font-weight: bold } /* Keyword */ .highlight .ch { color: #888888 } /* Comment.Hashbang */ .highlight .cm { color: #888888 } /* Comment.Multiline */ .highlight .cp { color: #cc0000; font-weight: bold } /* Comment.Preproc */ .highlight .cpf { color: #888888 } /* Comment.PreprocFile */ .highlight .c1 { color: #888888 } /* Comment.Single */ .highlight .cs { color: #cc0000; font-weight: bold; background-color: #fff0f0 } /* Comment.Special */ .highlight .gd { color: #000000; background-color: #ffdddd } /* Generic.Deleted */ .highlight .ge { font-style: italic } /* Generic.Emph */ .highlight .gr { color: #aa0000 } /* Generic.Error */ .highlight .gh { color: #333333 } /* Generic.Heading */ .highlight .gi { color: #000000; background-color: #ddffdd } /* Generic.Inserted */ .highlight .go { color: #888888 } /* Generic.Output */ .highlight .gp { color: #555555 } /* Generic.Prompt */ .highlight .gs { font-weight: bold } /* Generic.Strong */ .highlight .gu { color: #666666 } /* Generic.Subheading */ .highlight .gt { color: #aa0000 } /* Generic.Traceback */ .highlight .kc { color: #008800; font-weight: bold } /* Keyword.Constant */ .highlight .kd { color: #008800; font-weight: bold } /* Keyword.Declaration */ .highlight .kn { color: #008800; font-weight: bold } /* Keyword.Namespace */ .highlight .kp { color: #008800 } /* Keyword.Pseudo */ .highlight .kr { color: #008800; font-weight: bold } /* Keyword.Reserved */ .highlight .kt { color: #888888; font-weight: bold } /* Keyword.Type */ .highlight .m { color: #0000DD; font-weight: bold } /* Literal.Number */ .highlight .s { color: #dd2200; background-color: #fff0f0 } /* Literal.String */ .highlight .na { color: #336699 } /* Name.Attribute */ .highlight .nb { color: #003388 } /* Name.Builtin */ .highlight .nc { color: #bb0066; font-weight: bold } /* Name.Class */ .highlight .no { color: #003366; font-weight: bold } /* Name.Constant */ .highlight .nd { color: #555555 } /* Name.Decorator */ .highlight .ne { color: #bb0066; font-weight: bold } /* Name.Exception */ .highlight .nf { color: #0066bb; font-weight: bold } /* Name.Function */ .highlight .nl { color: #336699; font-style: italic } /* Name.Label */ .highlight .nn { color: #bb0066; font-weight: bold } /* Name.Namespace */ .highlight .py { color: #336699; font-weight: bold } /* Name.Property */ .highlight .nt { color: #bb0066; font-weight: bold } /* Name.Tag */ .highlight .nv { color: #336699 } /* Name.Variable */ .highlight .ow { color: #008800 } /* Operator.Word */ .highlight .w { color: #bbbbbb } /* Text.Whitespace */ .highlight .mb { color: #0000DD; font-weight: bold } /* Literal.Number.Bin */ .highlight .mf { color: #0000DD; font-weight: bold } /* Literal.Number.Float */ .highlight .mh { color: #0000DD; font-weight: bold } /* Literal.Number.Hex */ .highlight .mi { color: #0000DD; font-weight: bold } /* Literal.Number.Integer */ .highlight .mo { color: #0000DD; font-weight: bold } /* Literal.Number.Oct */ .highlight .sa { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Affix */ .highlight .sb { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Backtick */ .highlight .sc { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Char */ .highlight .dl { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Delimiter */ .highlight .sd { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Doc */ .highlight .s2 { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Double */ .highlight .se { color: #0044dd; background-color: #fff0f0 } /* Literal.String.Escape */ .highlight .sh { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Heredoc */ .highlight .si { color: #3333bb; background-color: #fff0f0 } /* Literal.String.Interpol */ .highlight .sx { color: #22bb22; background-color: #f0fff0 } /* Literal.String.Other */ .highlight .sr { color: #008800; background-color: #fff0ff } /* Literal.String.Regex */ .highlight .s1 { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Single */ .highlight .ss { color: #aa6600; background-color: #fff0f0 } /* Literal.String.Symbol */ .highlight .bp { color: #003388 } /* Name.Builtin.Pseudo */ .highlight .fm { color: #0066bb; font-weight: bold } /* Name.Function.Magic */ .highlight .vc { color: #336699 } /* Name.Variable.Class */ .highlight .vg { color: #dd7700 } /* Name.Variable.Global */ .highlight .vi { color: #3333bb } /* Name.Variable.Instance */ .highlight .vm { color: #336699 } /* Name.Variable.Magic */ .highlight .il { color: #0000DD; font-weight: bold } /* Literal.Number.Integer.Long */ }
#ifndef  RX_CHECK_H
#define  RX_CHECK_H
/*
 Hanoh Haim
 Cisco Systems, Inc.
*/

/*
Copyright (c) 2015-2015 Cisco Systems, Inc.

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

    http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/


#include "timer_wheel_pq.h"
#include "rx_check_header.h"
#include "time_histogram.h"
#include "utl_jitter.h"

                                 

typedef enum {
    CLIENT_SIDE = 0,    
    SERVER_SIDE = 1,    
    CS_NUM = 2,
    CS_INVALID = 255
} pkt_dir_enum_t;

typedef uint8_t   pkt_dir_t  ;


void  flow_aging_callback(CFlowTimerHandle * t);

class CRxCheckFlowPerDir {
public:
    CRxCheckFlowPerDir(){
        m_flags=0;
        m_pkts=0;
        m_seq=0;
        m_flow_size=0;

    }
    uint16_t         m_flow_size; // how many packets in this direction 
    uint16_t         m_pkts;
    uint16_t         m_seq;
private:
    uint16_t         m_flags;
public:

    void set_fif_seen(uint16_t flow_per_dir){
        m_pkts=1;
        m_seq=1;
        m_flags |=2;
        m_flow_size=flow_per_dir;
    }
    bool is_fif_seen(){
        return ( (m_flags & 2) ==2 ?true:false);
    }

    void set_init_not_from_first_packet(){
        m_flags |=1;
    }
    bool is_init_not_from_first_pkt(){
		return ( (m_flags & 2) ==2 ?true:false);
    }
};

class CRxCheckFlow {
public:
    CRxCheckFlow(){
        m_aging_timer_handle.m_callback =flow_aging_callback;
        m_aging_timer_handle.m_object = (void *)this;
        m_aging_timer_handle.m_id= 0x1234;
		m_oo_err=0;
        m_flags=0;
    }


public:
    /* timestamp of FIF */
    uint64_t            m_flow_id; /* key*/
    CRxCheckFlowPerDir  m_dir[CS_NUM];
    CFlowTimerHandle    m_aging_timer_handle;
    uint16_t            m_oo_err; /* out of order issue */
    uint16_t            m_flags;
public:

    uint16_t  get_total_pkt_seen(void){
        return (m_dir[0].m_pkts+
                m_dir[1].m_pkts);
    }
    uint16_t  get_total_pkt_expected(void){
        return (m_dir[0].m_flow_size+
                m_dir[1].m_flow_size);
    }

    bool      is_all_pkts_seen(void){
        int i;
        int c=0;
        for (i=0; i<2; i++) {
            if ( (m_dir[i].m_pkts!=m_dir[i].m_flow_size) ){
                return (false);
            }
            if (m_dir[i].m_flow_size>0) {
                c++;
            }
        }
        int expc=is_both_dir()?2:1;
        if ( expc == c ) {
            return ( (m_oo_err==0)?true:false );
        }
        return (false);
    }

    void set_both_dir(){
        m_flags |=2;
    }
    bool is_both_dir(){
        return ( (m_flags & 2) == 2 ?true:false);
    }



    void set_aged_correctly(){
        m_flags |=4;
    }
    bool is_aged_correctly(){
        return ( (m_flags & 4) ==4 ?true:false);
    }

};




class CRxCheckFlowTableStats {
public:

    uint64_t  m_total_rx;
    uint64_t  m_total_rx_bytes;

    uint64_t  m_lookup;
    uint64_t  m_found;
    uint64_t  m_fif;
    uint64_t  m_add;
    uint64_t  m_remove;
    uint64_t  m_active;
	uint64_t  m_err_drop;
	uint64_t  m_err_aged;


    uint64_t  m_err_no_magic;
    uint64_t  m_err_wrong_pkt_id;
    uint64_t  m_err_fif_seen_twice;
	uint64_t  m_err_open_with_no_fif_pkt;

	uint64_t  m_err_oo_dup; /* got same packets id twice  expect 1 got 0 */

	uint64_t  m_err_oo_early; /* miss packet ,expect 1 got 2 */
	uint64_t  m_err_oo_late;  /* early packet ,expect 7 got 6 */

    uint64_t  m_err_flow_length_changed;  /* early packet ,expect 7 got 6 */

    uint64_t get_total_err(void){
        return (m_err_drop+m_err_aged+
                    m_err_no_magic+
                    m_err_wrong_pkt_id+
                    m_err_fif_seen_twice+
                    m_err_open_with_no_fif_pkt+
                    m_err_oo_dup+
                    m_err_oo_early+
                    m_err_oo_late+m_err_flow_length_changed);

    }

public:
    void Clear();
    void Dump(FILE *fd);
    void dump_json(std::string & json);
};



typedef CRxCheckFlow * rx_check_flow_ptr;
typedef std::map<uint64_t, rx_check_flow_ptr, std::less<uint64_t> > rx_check_flow_map_t;
typedef rx_check_flow_map_t::iterator rx_check_flow_map_iter_t;


class CRxCheckFlowTableMap   {
public:
    virtual bool Create(int max_size);
    virtual void Delete();
    virtual bool remove(uint64_t fid );
    virtual CRxCheckFlow * lookup(uint64_t fid );
    virtual CRxCheckFlow * add(uint64_t fid );
    virtual void remove_all(void);
    void dump_all(FILE *fd);
    uint64_t count(void);
public:
    rx_check_flow_map_t          m_map;
};



class uint64_tHashEnv
{
public:
	static uint32_t Hash(uint64_t x)
	{
		return ( (x >>40) ^ (x & 0xffffffff));
	}
};

template<class T>
class CMyFSA {
public:
	bool Create(uint32_t size, bool supportGetNext, bool ctorRequired){
		return(true);
	}

    void Delete(){
	}
	void Reset(){
	}

	T * GetNewItem(){
		return (new T());
	}

	void ReturnItem(T *obj){
		delete obj;
	}
};



#if 0

typedef CHashEntry<uint64_t,CRxCheckFlow> rx_c_hash_ent_t;
typedef CCloseHash<uint64_t,CRxCheckFlow,uint64_tHashEnv,CMyFSA<rx_c_hash_ent_t> > rx_c_hash_t;


class CRxCheckFlowTableHash   {
public:
    bool Create(int max_size){
		return ( m_hash.Create(max_size,0,false,false,true) );
	}
    void Delete(){
		m_hash.Delete();
	}
    bool remove(uint64_t fid ) {
		return(m_hash.Remove(fid)==hsOK?true:false);
	}
    CRxCheckFlow * lookup(uint64_t fid ){
		rx_c_hash_ent_t *lp=m_hash.Find(fid);
		if (lp) {
			return (&lp->value);
		}else{
			return ((CRxCheckFlow *)NULL);
		}
	}
    CRxCheckFlow * add(uint64_t fid ){
		rx_c_hash_ent_t *lp;
		assert(m_hash.Insert(fid,lp)==hsOK);
		return (&lp->value);
	}

    void remove_all(void){
		
	}
    void dump_all(FILE *fd){
		m_hash.Dump(fd);
	}
    uint64_t count(void){
		return ( m_hash.GetSize());

	}
public:

	rx_c_hash_t                  m_hash;
};

#endif


// must be 2^
#define MAX_TEMPLATES_STATS 32

#define MAX_TEMPLATES_STATS_MASK (MAX_TEMPLATES_STATS-1)

class CPerTxthreadTemplateInfo {

public:
    CPerTxthreadTemplateInfo(){
        Clear();
    }
    void Clear(){
        memset(m_template_info,0,sizeof(m_template_info));
    }
    void Dump(FILE *fd);

    void Add(CPerTxthreadTemplateInfo * obj);

    void inc_template(uint8_t index){
        if (index<MAX_TEMPLATES_STATS) {
            m_template_info[index]++;
        }else{
            m_template_info[MAX_TEMPLATES_STATS-1]++;
        }
    }

    std::string dump_as_json(std::string name);

    uint64_t               m_template_info[MAX_TEMPLATES_STATS];
};

class CPerTemplateInfo {
public:
    CPerTemplateInfo()  {
        reset();
    }

    void reset(){
        m_errors=0;
        m_rx_pkts=0;
        m_jitter.reset();
    }

    void  calc(double dtime){
        m_jitter.calc(dtime);
    }

    uint32_t get_jitter_usec(){
        return ((uint32_t)(m_jitter.get_jitter()*1000000.0));
    }

    void      inc_error_counter(void){
        m_errors++;

    }

    uint64_t get_error_counter(){
        return (m_errors);
    }

    void      inc_rx_counter(void){
        m_rx_pkts++;
    }

    uint64_t get_rx_counter(){
        return (m_rx_pkts);
    }


private:
    uint64_t m_rx_pkts;
    CJitter  m_jitter;
    uint64_t m_errors;
};

class RxCheckManager {

public:
    bool Create();
    void Delete();
    void handle_packet(CRx_check_header * rxh);
	void Dump(FILE *fd);
    void DumpShort(FILE *fd);
    void DumpTemplate(FILE *fd,bool verbose);
    void DumpTemplateFull(FILE *fd);

    uint32_t getTemplateMaxJitter();

    void template_dump_json(std::string & json);

    uint64_t getTotalRx(void){
        return ( m_stats.m_total_rx );
    }

	void tw_drain();
    void tw_handle();

    void dump_json(std::string & json );

protected:
    void update_template_err(uint8_t template_id);

    CPerTemplateInfo * get_template(uint8_t index){
        uint8_t _id;
         if ( index < MAX_TEMPLATES_STATS_MASK ){
             _id=index;
         }else{
             _id=MAX_TEMPLATES_STATS_MASK;
         }
        return (&m_template_info[_id]);
    }

    bool on_flow_end(CRxCheckFlow * lp);
    friend void  flow_aging_callback(CFlowTimerHandle * t);
public:
    
    CTimerWheel                     m_tw;
    CRxCheckFlowTableMap           m_ft;
    CRxCheckFlowTableStats         m_stats;

    CTimeHistogram                 m_hist;
    CPerTemplateInfo               m_template_info[MAX_TEMPLATES_STATS];
    bool                           m_on_drain;
public:
    dsec_t                         m_cur_time;

};





#endif