Exemple #1
0
def json2ordererOrg(data):
    try:
        domain = data ['domain']
        name   = data ['org_name']
        orderers_data = data['orderers']
        orderers = []
        for orderer_data in orderers_data:
            orderers.append(json2orderer(orderer_data))
        return OrdererOrg(name, domain, orderers)
    except Exception as e:
        raise MyMalformedException("Malformed json ordererOrg") 
Exemple #2
0
def json2peerOrgs(data):
    try:
        peer_orgs = []
        for peerOrg in data:
            domain = peerOrg ['domain']
            name   = peerOrg ['org_name']
            ca = json2ca(peerOrg['ca'])
            peers_data = peerOrg['peers']
            peers = []
            for peer_data in peers_data:
                peers.append(json2peer(peer_data))
            peer_orgs.append(PeerOrg(name, domain, peers, ca))
        return peer_orgs
    except Exception as e :
        raise MyMalformedException("Malformed json peerOrg") 
Exemple #3
0
def json2orderer(data):
    try:
        return Orderer(data['address'], data['port'])
    except Exception:
        raise MyMalformedException("Malformed json orderer") 
Exemple #4
0
def json2channel(data):
    try:
        return Channel(data['name'])
    except Exception:
        raise MyMalformedException("Malformed json channel") 
Exemple #5
0
def json2cert(data):
    try:
        return  Cert(data['country'], data['province'], data['locality'])
    except Exception:
        raise MyMalformedException("Malformed json certificate") 
Exemple #6
0
def json2ca(data):
    try:
        return Ca(data['address'], data['port'])
    except Exception:
        raise MyMalformedException("Malformed json ca") 
Exemple #7
0
def json2peer(data):
    try:
        return Peer(data['address'], data['request_port'], data['event_port'])
    except Exception as e :
        raise MyMalformedException("Malformed json peer")