def shared_outputs(policy1, policy2): """Try to find packet in output of policy1 and egress of slice2.""" p, q, pp = Consts("p q pp", Packet) solv = Solver() solv.add(output(policy1, p, pp)) solv.add(egress(policy2, q, pp)) if solv.check() == unsat: return None else: return solv.model(), (p, pp), HEADER_INDEX
def shared_io(topo, policy1, policy2): """Try to find output of policy1 in the inputs of policy2.""" p, pp, q, qq = Consts("p pp q qq", Packet) o = Int("o") solv = Solver() solv.add(output(policy1, p, pp)) solv.add(transfer(topo, pp, q)) solv.add(input(policy2, q, qq, o)) if solv.check() == unsat: return None else: return solv.model(), (p, pp, q, qq), HEADER_INDEX