@param args keyword argument list, consisting of:

        source: <source service name>,
        dest: <destination service name>,
        messagetype: <request|response|publish|subscribe|stream>

        headerpattern: <regex to match against the value of the X-Gremlin-ID trackingheader present in HTTP headers>
        bodypattern: <regex to match against HTTP message body>

        delayprobability: <float, 0.0 to 1.0>
        delaydistribution: <uniform|exponential|normal> probability distribution function
        mangleprobability: <float, 0.0 to 1.0>
        mangledistribution: <uniform|exponential|normal> probability distribution function
        
        abortprobability: <float, 0.0 to 1.0>
        abortdistribution: <uniform|exponential|normal> probability distribution function
    
        delaytime: <string> latency to inject into requests <string, e.g., "10ms", "1s", "5m", "3h", "1s500ms">
        errorcode: <Number> HTTP error code or -1 to reset TCP connection
        searchstring: <string> string to replace when Mangle is enabled
        replacestring: <string> string to replace with for Mangle fault

def add_rule(self, **args):
        """
        @param args keyword argument list, consisting of:

        source: <source service name>,
        dest: <destination service name>,
        messagetype: <request|response|publish|subscribe|stream>

        headerpattern: <regex to match against the value of the X-Gremlin-ID trackingheader present in HTTP headers>
        bodypattern: <regex to match against HTTP message body>

        delayprobability: <float, 0.0 to 1.0>
        delaydistribution: <uniform|exponential|normal> probability distribution function
        mangleprobability: <float, 0.0 to 1.0>
        mangledistribution: <uniform|exponential|normal> probability distribution function
        
        abortprobability: <float, 0.0 to 1.0>
        abortdistribution: <uniform|exponential|normal> probability distribution function
    
        delaytime: <string> latency to inject into requests <string, e.g., "10ms", "1s", "5m", "3h", "1s500ms">
        errorcode: <Number> HTTP error code or -1 to reset TCP connection
        searchstring: <string> string to replace when Mangle is enabled
        replacestring: <string> string to replace with for Mangle fault
        """
        #The defaults are indicated below
        myrule = {
                  "source": "",
                  "dest": "",
                  "messagetype": "request",
                  "headerpattern": "*",
                  "bodypattern": "*",
                  "delayprobability": 0.0,
                  "delaydistribution": "uniform",
                  "mangleprobability": 0.0,
                  "mangledistribution": "uniform",
                  "abortprobability": 0.0,
                  "abortdistribution": "uniform",
                  "delaytime": "0s",
                  "errorcode": -1,
                  "searchstring": "",
                  "replacestring": ""
        }
        rule = args.copy()
        #copy
        for i in rule.keys():
            if i not in myrule:
                continue
            myrule[i] = rule[i]
        #check defaults
        services = self.app.get_services()
        assert myrule["source"] != "" and myrule["dest"] != ""
        assert myrule["source"] in services and myrule["dest"] in services
        assert myrule['headerpattern'] != "" or myrule["bodypattern"] != ""
        assert myrule['delayprobability'] >0.0 or myrule['abortprobability'] >0.0 or myrule['mangleprobability'] >0.0
        if myrule["delayprobability"] > 0.0:
            assert myrule["delaytime"] != ""
        if myrule["abortprobability"] > 0.0:
            assert myrule["errorcode"] >= -1
        assert myrule["messagetype"] in ["request", "response", "publish", "subscribe"]
        self._queue.append(myrule)