예제 #1
0
 def Init(self, spec):
     self.GID(spec.name)
     self.headers = objects.MergeObjects(getattr(spec, 'headers', None),
                                         self.headers)
     self.fields = objects.MergeObjects(getattr(spec, 'fields', None),
                                        self.fields)
     bases = getattr(spec, 'inherit', [])
     for base in bases:
         self.__inherit_base(base)
     return
예제 #2
0
    def __merge_section(self, name):
        spsn = None
        tpsn = self.template.__dict__[name]
        if name in self.__dict__:
            spsn = self.__dict__[name]

        self.__dict__[name] = objects.MergeObjects(spsn, tpsn)
        return
예제 #3
0
 def __process_one_header(self, header_spec):
     header_template = header_spec.template.Get(FactoryStore)
     assert (header_template)
     header = copy.deepcopy(header_template)
     header.fields = objects.MergeObjects(header_spec.fields,
                                          header_template.fields)
     self.headers.__dict__[header_spec.id] = header
     self.hdrsorder.append(header_spec.id)
     return
예제 #4
0
    def __merge_headers(self, tc):
        spec_hdrs = PacketHeaders(self.spec.headers)
        template_hdrs = PacketHeaders(self.template.headers)
        if self.headers:
            self.headers = objects.MergeObjects(spec_hdrs, self.headers)
        else:
            self.headers = spec_hdrs

        if self.GetPcap():
            # For PCAP based packets, dont inherit the default values from templates.
            # Any field that is not specified in testspec should retain its value from
            # the PCAP file.
            self.__copy_header_meta(template_hdrs)
        else:
            self.headers = objects.MergeObjects(self.headers, template_hdrs)
        self.hdrsorder = copy.deepcopy(self.template.hdrsorder)
        self.headers.show()
        return
예제 #5
0
 def __set_tcpudp_info(self, entry):
     if self.IsL4Lb():
         self.port = self.l4lb.GetServicePort()
     else:
         self.port = entry.port.get()
     if 'tracking_info' in entry.__dict__:
         self.tracking_info = objects.MergeObjects(entry.tracking_info,
                                                   self.tracking_info)
     return
예제 #6
0
    def __merge_encaps(self, tc):
        if self.encaps == None:
            return

        self.encaps.reverse()
        for enc in self.encaps:
            enc.headers = PacketHeaders(enc.headers)
            self.headers = objects.MergeObjects(self.headers, enc.headers)
            enc.meta.callback.call(self, enc)
        return
예제 #7
0
 def __init_step(self):
     base = getattr(self, 'base', None)
     if base is None:
         return
     base = base.Get(TrackerStore)
     self.fields = objects.MergeObjects(self.fields, base.fields)
     self.state = getattr(self, 'state', None)
     self.payloadsize = getattr(self, 'payloadsize', base.payloadsize)
     self.paddingsize = getattr(self, 'paddingsize', base.paddingsize)
     self.direction = getattr(self, 'direction', base.direction)
     self.advance = getattr(self, 'advance', base.advance)
     self.permit = getattr(self, 'permit', base.permit)
     self.delay = 1
     return
예제 #8
0
 def __set_info(self, entry):
     if 'hashgen' in entry.__dict__:
         self.hashgen = entry.hashgen
     if self.IsIP():
         self.__set_ip_ethertypes()
         if self.IsTCP() or self.IsUDP():
             self.__set_tcpudp_info(entry)
         elif self.IsICMP() or self.IsICMPV6():
             self.__set_icmp_info(entry)
         elif self.IsESP():
             self.__set_esp_info(entry)
     elif self.IsMAC():
         self.__set_mac_info(entry)
     else:
         assert (0)
     if 'flow_info' in entry.__dict__:
         self.flow_info = objects.MergeObjects(entry.flow_info,
                                               self.flow_info)
     return
예제 #9
0
    def Init(self, spec):
        self.spec = objects.MergeObjects(spec, self.spec)

        self.GID('QOS_CLASS_' + spec.group)

        self.hal_handle = None
        self.cmap_dot1q_pcp = 0

        if self.UplinkCmapNeeded():
            self.cmap_dot1q_pcp = resmgr.QosCosAllocator.get()

        if self.spec.marking.dot1q_pcp_en:
            self.spec.marking.dot1q_pcp = self.cmap_dot1q_pcp

        if self.spec.marking.ip_dscp_en:
            self.spec.marking.ip_dscp = resmgr.QosDscpAllocator.get()

        self.Show()
        return
예제 #10
0
    def Init(self, spec):
        self.fields = objects.MergeObjects(spec, self.fields)

        self.GID(spec.id)

        if self.MatchOnFlowMiss():
            self.fields.config_flow_miss = True

        self.ing_mirror_sessions = []
        self.egr_mirror_sessions = []
        self.update_in_progress = False
        for s in self.fields.action.mirror.ingress:
            ispan = s.Get(Store)
            self.ing_mirror_sessions.append(ispan)
        for s in self.fields.action.mirror.egress:
            espan = s.Get(Store)
            self.egr_mirror_sessions.append(espan)

        if self.ActionSupRedirect():
            self.fields.action.redirect_if = Store.objects.Get('Cpu1')
        #self.Show()
        return
예제 #11
0
 def Merge(self, selectors):
     newspec = objects.MergeObjects(selectors, self.spec)
     self.Clone(newspec)
     return
예제 #12
0
 def __merge_doorbell(self, sp, tp):
     if sp == None or tp == None: return
     if 'doorbell' not in sp.__dict__: return None
     return objects.MergeObjects(sp.doorbell, tp.doorbell)
예제 #13
0
 def __merge_obj_list(self, splist, tp):
     objs = []
     for sp in splist:
         obj = objects.MergeObjects(sp, tp)
         objs.append(obj)
     return objs